From 674328a50357c66fcae162037c2e3ea06515c545 Mon Sep 17 00:00:00 2001 From: Chrislearn Young Date: Fri, 10 Nov 2023 21:03:40 +0800 Subject: [PATCH] Rename ``set_inner_text` to `set_text` --- crates/cli/src/service/serve.rs | 6 +++--- crates/core/src/web/holders/browser.rs | 2 +- crates/core/src/web/widgets/csr.rs | 6 +++--- crates/core/src/web/widgets/mod.rs | 12 ++++++------ crates/core/src/web/widgets/ssr.rs | 6 +++--- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/crates/cli/src/service/serve.rs b/crates/cli/src/service/serve.rs index f133b4c..c4cb649 100644 --- a/crates/cli/src/service/serve.rs +++ b/crates/cli/src/service/serve.rs @@ -81,8 +81,8 @@ impl ServerProcess { // windows doesn't like to overwrite a running binary, so we copy it to a new name let bin_path = if cfg!(target_os = "windows") { // solution to allow cargo to overwrite a running binary on some platforms: - // copy cargo's output bin to [filename]_glory and then run it - let new_bin_path = append_str_to_filename(bin, "_glory")?; + // copy cargo's output bin to [filename].serving and then run it + let new_bin_path = append_str_to_filename(bin, ".serving")?; log::debug!( "Copying server binary {} to {}", GRAY.paint(bin.as_str()), @@ -91,7 +91,7 @@ impl ServerProcess { fs::copy(bin, &new_bin_path).await?; // also copy the .pdb file if it exists to allow debugging to attach if let Some(pdb) = determine_pdb_filename(bin) { - let new_pdb_path = append_str_to_filename(&pdb, "_glory")?; + let new_pdb_path = append_str_to_filename(&pdb, ".serving")?; log::debug!( "Copying server binary debug info {} to {}", GRAY.paint(pdb.as_str()), diff --git a/crates/core/src/web/holders/browser.rs b/crates/core/src/web/holders/browser.rs index 779da28..474cf92 100644 --- a/crates/core/src/web/holders/browser.rs +++ b/crates/core/src/web/holders/browser.rs @@ -37,7 +37,7 @@ impl Holder for BrowerHolder { if let Ok(list) = crate::web::document().query_selector_all("[gly-id]") { for i in 0..list.length() { let ele = list.item(i).unwrap().unchecked_into::(); - ele.set_attribute("gly-hydrating", "true").unwrap_throw(); + ele.set_attribute("gly-hydrating", "1").unwrap_throw(); } } let view_id = ViewId::new(self.next_root_view_id.fetch_add(1, Ordering::Relaxed).to_string()); diff --git a/crates/core/src/web/widgets/csr.rs b/crates/core/src/web/widgets/csr.rs index 246127a..34d03fd 100644 --- a/crates/core/src/web/widgets/csr.rs +++ b/crates/core/src/web/widgets/csr.rs @@ -327,7 +327,7 @@ where /// Be very careful when using this method. Always remember to /// sanitize the input to avoid a cross-site scripting (XSS) /// vulnerability. - pub fn set_inner_text(&mut self, text: V) + pub fn set_text(&mut self, text: V) where V: AttrValue + 'static, { @@ -340,11 +340,11 @@ where /// Be very careful when using this method. Always remember to /// sanitize the input to avoid a cross-site scripting (XSS) /// vulnerability. - pub fn inner_text(mut self, text: V) -> Self + pub fn text(mut self, text: V) -> Self where V: AttrValue + 'static, { - self.set_inner_text(text); + self.set_text(text); self } diff --git a/crates/core/src/web/widgets/mod.rs b/crates/core/src/web/widgets/mod.rs index df066e2..4198cc6 100644 --- a/crates/core/src/web/widgets/mod.rs +++ b/crates/core/src/web/widgets/mod.rs @@ -181,11 +181,11 @@ macro_rules! generate_tags { self.0.add_event_listener(event, event_handler); self } - pub fn inner_text(mut self, text: V) -> Self + pub fn text(mut self, text: V) -> Self where V: AttrValue + 'static, { - self.0.set_inner_text(text); + self.0.set_text(text); self } /// Sets the inner HTML of this element from the provided @@ -292,7 +292,7 @@ generate_tags![ style Style HtmlStyleElement [media, disabled], /// The `` HTML element defines the document's title that is shown in a Browser's title bar or a page's tab. It only contains text; tags within the element are ignored. - title Title HtmlTitleElement [text], + title Title HtmlTitleElement [], // ========================== // Sectioning Root @@ -394,7 +394,7 @@ generate_tags![ // Inline Text Semantics // ========================== /// The `<a>` HTML element (or anchor element), with its href attribute, creates a hyperlink to web pages, files, email addresses, locations in the same page, or anything else a URL can address. - a A HtmlAnchorElement [access_key "accessKey", download, hash, host, host_name "hostname", href, href_lang "hreflang", password, path_name "pathname", port, protocol, referrer_policy "referrerPolicy", rel, search, tab_index "tabIndex", target, text, type_ "type", user_name "username"], + a A HtmlAnchorElement [access_key "accessKey", download, hash, host, host_name "hostname", href, href_lang "hreflang", password, path_name "pathname", port, protocol, referrer_policy "referrerPolicy", rel, search, tab_index "tabIndex", target, type_ "type", user_name "username"], /// The `<abbr>` HTML element represents an abbreviation or acronym; the optional title attribute can provide an expansion or description for the abbreviation. If present, title must contain this full description and nothing else. abbr Abbr HtmlElement [], @@ -544,7 +544,7 @@ generate_tags![ noscript NoScript HtmlElement [], /// The `<script>` HTML element is used to embed executable code or data; this is typically used to embed or refer to JavaScript code. The `<script>` element can also be used with other languages, such as WebGL's GLSL shader programming language and JSON. - script Script HtmlScriptElement [type_ "type", src, async_ "async", defer, cross_origin "crossOrigin", text, fetch_priority "fetchPriority", referrer_policy "referrerPolicy"], + script Script HtmlScriptElement [type_ "type", src, async_ "async", defer, cross_origin "crossOrigin", fetch_priority "fetchPriority", referrer_policy "referrerPolicy"], // ========================== // Demarcating Edits @@ -619,7 +619,7 @@ generate_tags![ optgroup OptGroup HtmlOptGroupElement [disabled, label], /// The `<option>` HTML element is used to define an item contained in a select, an optgroup, or a datalist element. As such, `<option>` can represent menu items in popups and other lists of items in an HTML document. - option_ Option HtmlOptionElement [default_selected "defaultSelected", disabled, selected, text, value], + option_ Option HtmlOptionElement [default_selected "defaultSelected", disabled, selected, value], /// The `<output>` HTML element is a container element into which a site or app can inject the results of a calculation or the outcome of a user action. output Output HtmlOutputElement [default_value "defaultValue", name, value], diff --git a/crates/core/src/web/widgets/ssr.rs b/crates/core/src/web/widgets/ssr.rs index b4b0039..3ded7ca 100644 --- a/crates/core/src/web/widgets/ssr.rs +++ b/crates/core/src/web/widgets/ssr.rs @@ -245,7 +245,7 @@ impl Element { /// Be very careful when using this method. Always remember to /// sanitize the input to avoid a cross-site scripting (XSS) /// vulnerability. - pub fn set_inner_text<V>(&mut self, text: V) + pub fn set_text<V>(&mut self, text: V) where V: AttrValue + 'static, { @@ -258,11 +258,11 @@ impl Element { /// Be very careful when using this method. Always remember to /// sanitize the input to avoid a cross-site scripting (XSS) /// vulnerability. - pub fn inner_text<V>(mut self, text: V) -> Self + pub fn text<V>(mut self, text: V) -> Self where V: AttrValue + 'static, { - self.set_inner_text(text); + self.set_text(text); self }