mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
Updated SupportedPropertyNames in NamedNodeMap to match spec
This commit is contained in:
parent
4a7d234510
commit
aaf2888d0b
2 changed files with 14 additions and 8 deletions
|
@ -13,6 +13,7 @@ use dom::bindings::reflector::{Reflector, reflect_dom_object};
|
||||||
use dom::bindings::xmlname::namespace_from_domstring;
|
use dom::bindings::xmlname::namespace_from_domstring;
|
||||||
use dom::element::Element;
|
use dom::element::Element;
|
||||||
use dom::window::Window;
|
use dom::window::Window;
|
||||||
|
use std::ascii::AsciiExt;
|
||||||
use string_cache::Atom;
|
use string_cache::Atom;
|
||||||
use util::str::DOMString;
|
use util::str::DOMString;
|
||||||
|
|
||||||
|
@ -99,8 +100,18 @@ impl NamedNodeMapMethods for NamedNodeMap {
|
||||||
|
|
||||||
// https://heycam.github.io/webidl/#dfn-supported-property-names
|
// https://heycam.github.io/webidl/#dfn-supported-property-names
|
||||||
fn SupportedPropertyNames(&self) -> Vec<DOMString> {
|
fn SupportedPropertyNames(&self) -> Vec<DOMString> {
|
||||||
self.owner.attrs().iter().map(|attr| {
|
let mut names = vec!();
|
||||||
DOMString::from(&**attr.name()) // FIXME(ajeffrey): Convert directly from &Atom to DOMString
|
let html_element_in_html_document = self.owner.html_element_in_html_document();
|
||||||
}).collect()
|
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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue