diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2018-09-19 17:47:27 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-19 17:47:27 -0400 |
commit | df2adebefdfa3da49f173e480fa1e56450f9bda2 (patch) | |
tree | 1f05b49bac02318455a59d5b143c186fd872bdb9 /components/script/dom/namednodemap.rs | |
parent | 2ca7a134736bb4759ff209c1bc0b6dc3cc1984c9 (diff) | |
parent | c37a345dc9f4dda6ea29c42f96f6c7201c42cbac (diff) | |
download | servo-df2adebefdfa3da49f173e480fa1e56450f9bda2.tar.gz servo-df2adebefdfa3da49f173e480fa1e56450f9bda2.zip |
Auto merge of #21737 - chansuke:format_script, r=jdm
Format script component
---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [ ] These changes fix part of #21373.
- [x] These changes do not require tests because they format code only.
<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->
<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/21737)
<!-- Reviewable:end -->
Diffstat (limited to 'components/script/dom/namednodemap.rs')
-rw-r--r-- | components/script/dom/namednodemap.rs | 37 |
1 files changed, 26 insertions, 11 deletions
diff --git a/components/script/dom/namednodemap.rs b/components/script/dom/namednodemap.rs index 81540854584..c0ed5744355 100644 --- a/components/script/dom/namednodemap.rs +++ b/components/script/dom/namednodemap.rs @@ -31,8 +31,11 @@ impl NamedNodeMap { } pub fn new(window: &Window, elem: &Element) -> DomRoot<NamedNodeMap> { - reflect_dom_object(Box::new(NamedNodeMap::new_inherited(elem)), - window, NamedNodeMapBinding::Wrap) + reflect_dom_object( + Box::new(NamedNodeMap::new_inherited(elem)), + window, + NamedNodeMapBinding::Wrap, + ) } } @@ -44,7 +47,10 @@ impl NamedNodeMapMethods for NamedNodeMap { // https://dom.spec.whatwg.org/#dom-namednodemap-item fn Item(&self, index: u32) -> Option<DomRoot<Attr>> { - self.owner.attrs().get(index as usize).map(|js| DomRoot::from_ref(&**js)) + self.owner + .attrs() + .get(index as usize) + .map(|js| DomRoot::from_ref(&**js)) } // https://dom.spec.whatwg.org/#dom-namednodemap-getnameditem @@ -53,8 +59,11 @@ impl NamedNodeMapMethods for NamedNodeMap { } // https://dom.spec.whatwg.org/#dom-namednodemap-getnameditemns - fn GetNamedItemNS(&self, namespace: Option<DOMString>, local_name: DOMString) - -> Option<DomRoot<Attr>> { + fn GetNamedItemNS( + &self, + namespace: Option<DOMString>, + local_name: DOMString, + ) -> Option<DomRoot<Attr>> { let ns = namespace_from_domstring(namespace); self.owner.get_attribute(&ns, &LocalName::from(local_name)) } @@ -72,14 +81,20 @@ impl NamedNodeMapMethods for NamedNodeMap { // https://dom.spec.whatwg.org/#dom-namednodemap-removenameditem fn RemoveNamedItem(&self, name: DOMString) -> Fallible<DomRoot<Attr>> { let name = self.owner.parsed_name(name); - self.owner.remove_attribute_by_name(&name).ok_or(Error::NotFound) + self.owner + .remove_attribute_by_name(&name) + .ok_or(Error::NotFound) } // https://dom.spec.whatwg.org/#dom-namednodemap-removenameditemns - fn RemoveNamedItemNS(&self, namespace: Option<DOMString>, local_name: DOMString) - -> Fallible<DomRoot<Attr>> { + fn RemoveNamedItemNS( + &self, + namespace: Option<DOMString>, + local_name: DOMString, + ) -> Fallible<DomRoot<Attr>> { let ns = namespace_from_domstring(namespace); - self.owner.remove_attribute(&ns, &LocalName::from(local_name)) + self.owner + .remove_attribute(&ns, &LocalName::from(local_name)) .ok_or(Error::NotFound) } @@ -95,12 +110,12 @@ impl NamedNodeMapMethods for NamedNodeMap { // https://heycam.github.io/webidl/#dfn-supported-property-names fn SupportedPropertyNames(&self) -> Vec<DOMString> { - let mut names = vec!(); + let mut names = vec![]; let html_element_in_html_document = self.owner.html_element_in_html_document(); for attr in self.owner.attrs().iter() { let s = &**attr.name(); if html_element_in_html_document && !s.bytes().all(|b| b.to_ascii_lowercase() == b) { - continue + continue; } if !names.iter().any(|name| &*name == s) { |