diff --git a/components/script/dom/namednodemap.rs b/components/script/dom/namednodemap.rs index 94e21b65bf6..50a2894b8ff 100644 --- a/components/script/dom/namednodemap.rs +++ b/components/script/dom/namednodemap.rs @@ -13,6 +13,7 @@ use dom::bindings::reflector::{Reflector, reflect_dom_object}; use dom::bindings::xmlname::namespace_from_domstring; use dom::element::Element; use dom::window::Window; +use std::ascii::AsciiExt; use string_cache::Atom; use util::str::DOMString; @@ -99,8 +100,18 @@ impl NamedNodeMapMethods for NamedNodeMap { // https://heycam.github.io/webidl/#dfn-supported-property-names fn SupportedPropertyNames(&self) -> Vec { - self.owner.attrs().iter().map(|attr| { - DOMString::from(&**attr.name()) // FIXME(ajeffrey): Convert directly from &Atom to DOMString - }).collect() + 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 + } + + if !names.iter().any(|name| &*name == s) { + names.push(DOMString::from(s)); + } + } + names } } diff --git a/tests/wpt/metadata/dom/nodes/attributes.html.ini b/tests/wpt/metadata/dom/nodes/attributes.html.ini deleted file mode 100644 index 1f0e7d4973e..00000000000 --- a/tests/wpt/metadata/dom/nodes/attributes.html.ini +++ /dev/null @@ -1,5 +0,0 @@ -[attributes.html] - type: testharness - [Own property names should only include all-lowercase qualified names for an HTML element in an HTML document] - expected: FAIL -