diff options
author | Patrick Walton <pcwalton@mimiga.net> | 2014-09-12 13:28:37 -0700 |
---|---|---|
committer | Patrick Walton <pcwalton@mimiga.net> | 2014-10-14 10:32:40 -0700 |
commit | ee2ccc4f872ba33a86057d87a99d1015b3c41cf1 (patch) | |
tree | 3a7ef263aa401fb3a36e9d48ff5bc8a384ab1f65 /components/script/dom/htmlscriptelement.rs | |
parent | d1685015559562a42cc440f4e3b7a97d38cc642c (diff) | |
download | servo-ee2ccc4f872ba33a86057d87a99d1015b3c41cf1.tar.gz servo-ee2ccc4f872ba33a86057d87a99d1015b3c41cf1.zip |
script: Use atom comparison in more places, especially for attributes.
75% improvement in style recalc for Guardians of the Galaxy.
Diffstat (limited to 'components/script/dom/htmlscriptelement.rs')
-rw-r--r-- | components/script/dom/htmlscriptelement.rs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/components/script/dom/htmlscriptelement.rs b/components/script/dom/htmlscriptelement.rs index 138c7ea8679..e4c268d5713 100644 --- a/components/script/dom/htmlscriptelement.rs +++ b/components/script/dom/htmlscriptelement.rs @@ -75,7 +75,7 @@ static SCRIPT_JS_MIMES: StaticStringVec = &[ impl<'a> HTMLScriptElementHelpers for JSRef<'a, HTMLScriptElement> { fn is_javascript(self) -> bool { let element: JSRef<Element> = ElementCast::from_ref(self); - match element.get_attribute(ns!(""), "type").root().map(|s| s.Value()) { + match element.get_attribute(ns!(""), &atom!("type")).root().map(|s| s.Value()) { Some(ref s) if s.is_empty() => { // type attr exists, but empty means js debug!("script type empty, inferring js"); @@ -87,7 +87,9 @@ impl<'a> HTMLScriptElementHelpers for JSRef<'a, HTMLScriptElement> { }, None => { debug!("no script type"); - match element.get_attribute(ns!(""), "language").root().map(|s| s.Value()) { + match element.get_attribute(ns!(""), &atom!("language")) + .root() + .map(|s| s.Value()) { Some(ref s) if s.is_empty() => { debug!("script language empty, inferring js"); true @@ -109,7 +111,7 @@ impl<'a> HTMLScriptElementHelpers for JSRef<'a, HTMLScriptElement> { impl<'a> HTMLScriptElementMethods for JSRef<'a, HTMLScriptElement> { fn Src(self) -> DOMString { let element: JSRef<Element> = ElementCast::from_ref(self); - element.get_url_attribute("src") + element.get_url_attribute(&atom!("src")) } // http://www.whatwg.org/html/#dom-script-text |