diff options
Diffstat (limited to 'components/script')
-rw-r--r-- | components/script/dom/attr.rs | 6 | ||||
-rw-r--r-- | components/script/dom/document.rs | 4 | ||||
-rw-r--r-- | components/script/dom/domtokenlist.rs | 2 | ||||
-rw-r--r-- | components/script/dom/element.rs | 26 | ||||
-rw-r--r-- | components/script/dom/htmlanchorelement.rs | 2 | ||||
-rw-r--r-- | components/script/dom/htmlelement.rs | 2 | ||||
-rw-r--r-- | components/script/dom/htmliframeelement.rs | 2 | ||||
-rw-r--r-- | components/script/dom/htmlinputelement.rs | 2 | ||||
-rw-r--r-- | components/script/dom/htmllinkelement.rs | 2 | ||||
-rw-r--r-- | components/script/dom/htmlobjectelement.rs | 4 | ||||
-rw-r--r-- | components/script/dom/htmlscriptelement.rs | 12 | ||||
-rw-r--r-- | components/script/dom/node.rs | 2 |
12 files changed, 33 insertions, 33 deletions
diff --git a/components/script/dom/attr.rs b/components/script/dom/attr.rs index 3c174a993c6..cdc472d6e3f 100644 --- a/components/script/dom/attr.rs +++ b/components/script/dom/attr.rs @@ -250,15 +250,15 @@ impl<'a> AttrHelpers<'a> for JSRef<'a, Attr> { /// Sets the owner element. Should be called after the attribute is added /// or removed from its older parent. fn set_owner(self, owner: Option<JSRef<Element>>) { - let ns = self.namespace.clone(); + let ref ns = self.namespace; match (self.owner().root().r(), owner) { (None, Some(new)) => { // Already in the list of attributes of new owner. - assert!(new.get_attribute(ns, &self.local_name).root().r() == Some(self)) + assert!(new.get_attribute(&ns, &self.local_name).root().r() == Some(self)) } (Some(old), None) => { // Already gone from the list of attributes of old owner. - assert!(old.get_attribute(ns, &self.local_name).is_none()) + assert!(old.get_attribute(&ns, &self.local_name).is_none()) } (old, new) => assert!(old == new) } diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs index 49eaef294d5..dcf96d66399 100644 --- a/components/script/dom/document.rs +++ b/components/script/dom/document.rs @@ -369,7 +369,7 @@ impl<'a> DocumentHelpers<'a> for JSRef<'a, Document> { self.GetElementById(fragid.clone()).or_else(|| { let check_anchor = |&node: &JSRef<HTMLAnchorElement>| { let elem: JSRef<Element> = ElementCast::from_ref(node); - elem.get_attribute(ns!(""), &atom!("name")).root().map_or(false, |attr| { + elem.get_attribute(&ns!(""), &atom!("name")).root().map_or(false, |attr| { // FIXME(https://github.com/rust-lang/rust/issues/23338) let attr = attr.r(); let value = attr.value(); @@ -1280,7 +1280,7 @@ impl<'a> DocumentMethods for JSRef<'a, Document> { Some(element) => element, None => return false, }; - element.get_attribute(ns!(""), &atom!("name")).root().map_or(false, |attr| { + element.get_attribute(&ns!(""), &atom!("name")).root().map_or(false, |attr| { // FIXME(https://github.com/rust-lang/rust/issues/23338) let attr = attr.r(); let value = attr.value(); diff --git a/components/script/dom/domtokenlist.rs b/components/script/dom/domtokenlist.rs index 7d28c067acc..508322da0ed 100644 --- a/components/script/dom/domtokenlist.rs +++ b/components/script/dom/domtokenlist.rs @@ -50,7 +50,7 @@ trait PrivateDOMTokenListHelpers { impl<'a> PrivateDOMTokenListHelpers for JSRef<'a, DOMTokenList> { fn attribute(self) -> Option<Temporary<Attr>> { let element = self.element.root(); - element.r().get_attribute(ns!(""), &self.local_name) + element.r().get_attribute(&ns!(""), &self.local_name) } fn check_token_exceptions(self, token: &str) -> Fallible<Atom> { diff --git a/components/script/dom/element.rs b/components/script/dom/element.rs index 5a43946d64a..943f7b54f16 100644 --- a/components/script/dom/element.rs +++ b/components/script/dom/element.rs @@ -608,7 +608,7 @@ impl<'a> ElementHelpers<'a> for JSRef<'a, Element> { pub trait AttributeHandlers { /// Returns the attribute with given namespace and case-sensitive local /// name, if any. - fn get_attribute(self, namespace: Namespace, local_name: &Atom) + fn get_attribute(self, namespace: &Namespace, local_name: &Atom) -> Option<Temporary<Attr>>; /// Returns the first attribute with any namespace and given case-sensitive /// name, if any. @@ -655,9 +655,9 @@ pub trait AttributeHandlers { } impl<'a> AttributeHandlers for JSRef<'a, Element> { - fn get_attribute(self, namespace: Namespace, local_name: &Atom) -> Option<Temporary<Attr>> { + fn get_attribute(self, namespace: &Namespace, local_name: &Atom) -> Option<Temporary<Attr>> { self.get_attributes(local_name).into_iter().map(|attr| attr.root()) - .find(|attr| *attr.r().namespace() == namespace) + .find(|attr| attr.r().namespace() == namespace) .map(|x| Temporary::from_rooted(x.r())) } @@ -814,7 +814,7 @@ impl<'a> AttributeHandlers for JSRef<'a, Element> { NoQuirks | LimitedQuirks => lhs == rhs, Quirks => lhs.eq_ignore_ascii_case(&rhs) }; - self.get_attribute(ns!(""), &atom!("class")).root().map(|attr| { + self.get_attribute(&ns!(""), &atom!("class")).root().map(|attr| { // FIXME(https://github.com/rust-lang/rust/issues/23338) let attr = attr.r(); let value = attr.value(); @@ -872,7 +872,7 @@ impl<'a> AttributeHandlers for JSRef<'a, Element> { } fn get_string_attribute(self, name: &Atom) -> DOMString { - match self.get_attribute(ns!(""), name) { + match self.get_attribute(&ns!(""), name) { Some(x) => x.root().r().Value(), None => "".to_owned() } @@ -883,7 +883,7 @@ impl<'a> AttributeHandlers for JSRef<'a, Element> { } fn get_tokenlist_attribute(self, name: &Atom) -> Vec<Atom> { - self.get_attribute(ns!(""), name).root().map(|attr| { + self.get_attribute(&ns!(""), name).root().map(|attr| { // FIXME(https://github.com/rust-lang/rust/issues/23338) let attr = attr.r(); let value = attr.value(); @@ -907,7 +907,7 @@ impl<'a> AttributeHandlers for JSRef<'a, Element> { assert!(name.chars().all(|ch| { !ch.is_ascii() || ch.to_ascii_lowercase() == ch })); - let attribute = self.get_attribute(ns!(""), name).root(); + let attribute = self.get_attribute(&ns!(""), name).root(); match attribute { Some(attribute) => { match *attribute.r().value() { @@ -1008,7 +1008,7 @@ impl<'a> ElementMethods for JSRef<'a, Element> { fn GetAttributeNS(self, namespace: Option<DOMString>, local_name: DOMString) -> Option<DOMString> { - let namespace = namespace::from_domstring(namespace); + let namespace = &namespace::from_domstring(namespace); self.get_attribute(namespace, &Atom::from_slice(&local_name)).root() .map(|attr| attr.r().Value()) } @@ -1406,7 +1406,7 @@ impl<'a> VirtualMethods for JSRef<'a, Element> { if !tree_in_doc { return; } - if let Some(attr) = self.get_attribute(ns!(""), &atom!("id")).root() { + if let Some(attr) = self.get_attribute(&ns!(""), &atom!("id")).root() { let doc = document_from_node(*self).root(); let value = attr.r().Value(); if !value.is_empty() { @@ -1423,7 +1423,7 @@ impl<'a> VirtualMethods for JSRef<'a, Element> { if !tree_in_doc { return; } - if let Some(attr) = self.get_attribute(ns!(""), &atom!("id")).root() { + if let Some(attr) = self.get_attribute(&ns!(""), &atom!("id")).root() { let doc = document_from_node(*self).root(); let value = attr.r().Value(); if !value.is_empty() { @@ -1437,7 +1437,7 @@ impl<'a> VirtualMethods for JSRef<'a, Element> { impl<'a> style::node::TElement<'a> for JSRef<'a, Element> { #[allow(unsafe_code)] fn get_attr(self, namespace: &Namespace, attr: &Atom) -> Option<&'a str> { - self.get_attribute(namespace.clone(), attr).root().map(|attr| { + self.get_attribute(namespace, attr).root().map(|attr| { // This transmute is used to cheat the lifetime restriction. // FIXME(https://github.com/rust-lang/rust/issues/23338) let attr = attr.r(); @@ -1497,7 +1497,7 @@ impl<'a> style::node::TElement<'a> for JSRef<'a, Element> { node.get_focus_state() } fn get_id(self) -> Option<Atom> { - self.get_attribute(ns!(""), &atom!("id")).map(|attr| { + self.get_attribute(&ns!(""), &atom!("id")).map(|attr| { let attr = attr.root(); // FIXME(https://github.com/rust-lang/rust/issues/23338) let attr = attr.r(); @@ -1542,7 +1542,7 @@ impl<'a> style::node::TElement<'a> for JSRef<'a, Element> { fn each_class<F>(self, mut callback: F) where F: FnMut(&Atom) { - if let Some(ref attr) = self.get_attribute(ns!(""), &atom!("class")).root() { + if let Some(ref attr) = self.get_attribute(&ns!(""), &atom!("class")).root() { if let Some(tokens) = attr.r().value().tokens() { for token in tokens { callback(token) diff --git a/components/script/dom/htmlanchorelement.rs b/components/script/dom/htmlanchorelement.rs index 0856aae3c80..1219692cd9b 100644 --- a/components/script/dom/htmlanchorelement.rs +++ b/components/script/dom/htmlanchorelement.rs @@ -122,7 +122,7 @@ impl<'a> Activatable for JSRef<'a, HTMLAnchorElement> { //TODO: Step 3. Handle <img ismap/>. //TODO: Step 4. Download the link is `download` attribute is set. let element: JSRef<Element> = ElementCast::from_ref(*self); - let attr = element.get_attribute(ns!(""), &atom!("href")).root(); + let attr = element.get_attribute(&ns!(""), &atom!("href")).root(); match attr { Some(ref href) => { let value = href.r().Value(); diff --git a/components/script/dom/htmlelement.rs b/components/script/dom/htmlelement.rs index 3c448e3ff1d..ad2e96abf1a 100644 --- a/components/script/dom/htmlelement.rs +++ b/components/script/dom/htmlelement.rs @@ -196,7 +196,7 @@ impl<'a> HTMLElementCustomAttributeHelpers for JSRef<'a, HTMLElement> { fn get_custom_attr(self, name: DOMString) -> Option<DOMString> { let element: JSRef<Element> = ElementCast::from_ref(self); - element.get_attribute(ns!(""), &Atom::from_slice(&to_snake_case(name))).map(|attr| { + element.get_attribute(&ns!(""), &Atom::from_slice(&to_snake_case(name))).map(|attr| { let attr = attr.root(); // FIXME(https://github.com/rust-lang/rust/issues/23338) let attr = attr.r(); diff --git a/components/script/dom/htmliframeelement.rs b/components/script/dom/htmliframeelement.rs index 1c5e9ec2349..cbb6ee436a3 100644 --- a/components/script/dom/htmliframeelement.rs +++ b/components/script/dom/htmliframeelement.rs @@ -83,7 +83,7 @@ impl<'a> HTMLIFrameElementHelpers for JSRef<'a, HTMLIFrameElement> { fn get_url(self) -> Option<Url> { let element: JSRef<Element> = ElementCast::from_ref(self); - element.get_attribute(ns!(""), &atom!("src")).root().and_then(|src| { + element.get_attribute(&ns!(""), &atom!("src")).root().and_then(|src| { let url = src.r().value(); if url.as_slice().is_empty() { None diff --git a/components/script/dom/htmlinputelement.rs b/components/script/dom/htmlinputelement.rs index e4ebabb9e13..9223ac7ad60 100644 --- a/components/script/dom/htmlinputelement.rs +++ b/components/script/dom/htmlinputelement.rs @@ -391,7 +391,7 @@ impl<'a> HTMLInputElementHelpers for JSRef<'a, HTMLInputElement> { fn get_radio_group_name(self) -> Option<String> { //TODO: determine form owner let elem: JSRef<Element> = ElementCast::from_ref(self); - elem.get_attribute(ns!(""), &atom!("name")) + elem.get_attribute(&ns!(""), &atom!("name")) .root() .map(|name| name.r().Value()) } diff --git a/components/script/dom/htmllinkelement.rs b/components/script/dom/htmllinkelement.rs index 8014a7af4af..91c64c032ee 100644 --- a/components/script/dom/htmllinkelement.rs +++ b/components/script/dom/htmllinkelement.rs @@ -58,7 +58,7 @@ impl HTMLLinkElement { } fn get_attr(element: JSRef<Element>, name: &Atom) -> Option<String> { - let elem = element.get_attribute(ns!(""), name).root(); + let elem = element.get_attribute(&ns!(""), name).root(); elem.map(|e| { // FIXME(https://github.com/rust-lang/rust/issues/23338) let e = e.r(); diff --git a/components/script/dom/htmlobjectelement.rs b/components/script/dom/htmlobjectelement.rs index 88bf53a1365..ae730c102ac 100644 --- a/components/script/dom/htmlobjectelement.rs +++ b/components/script/dom/htmlobjectelement.rs @@ -62,8 +62,8 @@ impl<'a> ProcessDataURL for JSRef<'a, HTMLObjectElement> { let elem: JSRef<Element> = ElementCast::from_ref(*self); // TODO: support other values - match (elem.get_attribute(ns!(""), &atom!("type")).map(|x| x.root().r().Value()), - elem.get_attribute(ns!(""), &atom!("data")).map(|x| x.root().r().Value())) { + match (elem.get_attribute(&ns!(""), &atom!("type")).map(|x| x.root().r().Value()), + elem.get_attribute(&ns!(""), &atom!("data")).map(|x| x.root().r().Value())) { (None, Some(uri)) => { if is_image_data(uri.as_slice()) { let data_url = Url::parse(uri.as_slice()).unwrap(); diff --git a/components/script/dom/htmlscriptelement.rs b/components/script/dom/htmlscriptelement.rs index 5357c146ae5..7b4f7a8aea0 100644 --- a/components/script/dom/htmlscriptelement.rs +++ b/components/script/dom/htmlscriptelement.rs @@ -202,8 +202,8 @@ impl<'a> HTMLScriptElementHelpers for JSRef<'a, HTMLScriptElement> { } // Step 12. - let for_attribute = element.get_attribute(ns!(""), &atom!("for")).root(); - let event_attribute = element.get_attribute(ns!(""), &Atom::from_slice("event")).root(); + let for_attribute = element.get_attribute(&ns!(""), &atom!("for")).root(); + let event_attribute = element.get_attribute(&ns!(""), &Atom::from_slice("event")).root(); match (for_attribute.r(), event_attribute.r()) { (Some(for_attribute), Some(event_attribute)) => { let for_value = for_attribute.Value() @@ -223,7 +223,7 @@ impl<'a> HTMLScriptElementHelpers for JSRef<'a, HTMLScriptElement> { } // Step 13. - if let Some(charset) = element.get_attribute(ns!(""), &Atom::from_slice("charset")).root() { + if let Some(charset) = element.get_attribute(&ns!(""), &Atom::from_slice("charset")).root() { if let Some(encodingRef) = encoding_from_whatwg_label(&charset.r().Value()) { *self.block_character_encoding.borrow_mut() = encodingRef; } @@ -234,7 +234,7 @@ impl<'a> HTMLScriptElementHelpers for JSRef<'a, HTMLScriptElement> { let window = window.r(); let base_url = window.get_url(); - let load = match element.get_attribute(ns!(""), &atom!("src")).root() { + let load = match element.get_attribute(&ns!(""), &atom!("src")).root() { // Step 14. Some(src) => { // Step 14.1 @@ -406,7 +406,7 @@ 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!(""), &atom!("type")).root().map(|s| s.r().Value()) { + match element.get_attribute(&ns!(""), &atom!("type")).root().map(|s| s.r().Value()) { Some(ref s) if s.is_empty() => { // type attr exists, but empty means js debug!("script type empty, inferring js"); @@ -418,7 +418,7 @@ impl<'a> HTMLScriptElementHelpers for JSRef<'a, HTMLScriptElement> { }, None => { debug!("no script type"); - match element.get_attribute(ns!(""), &atom!("language")) + match element.get_attribute(&ns!(""), &atom!("language")) .root() .map(|s| s.r().Value()) { Some(ref s) if s.is_empty() => { diff --git a/components/script/dom/node.rs b/components/script/dom/node.rs index f9b81cad136..564777e0560 100644 --- a/components/script/dom/node.rs +++ b/components/script/dom/node.rs @@ -2343,7 +2343,7 @@ impl<'a> style::node::TNode<'a> for JSRef<'a, Node> { }; match attr.namespace { NamespaceConstraint::Specific(ref ns) => { - self.as_element().get_attribute(ns.clone(), name).root() + self.as_element().get_attribute(ns, name).root() .map_or(false, |attr| { // FIXME(https://github.com/rust-lang/rust/issues/23338) let attr = attr.r(); |