diff --git a/src/components/script/dom/element.rs b/src/components/script/dom/element.rs index 203b0099116..1fe2c9f80bd 100644 --- a/src/components/script/dom/element.rs +++ b/src/components/script/dom/element.rs @@ -6,7 +6,7 @@ use dom::attr::{Attr, ReplacedAttr, FirstSetAttr, AttrHelpersForLayout}; use dom::attr::{AttrValue, StringAttrValue, UIntAttrValue, AtomAttrValue}; -use dom::attrlist::AttrList; +use dom::namednodemap::NamedNodeMap; use dom::bindings::codegen::Bindings::AttrBinding::AttrMethods; use dom::bindings::codegen::Bindings::ElementBinding; use dom::bindings::codegen::Bindings::ElementBinding::ElementMethods; @@ -49,7 +49,7 @@ pub struct Element { pub prefix: Option, pub attrs: RefCell>>, pub style_attribute: Traceable>>, - pub attr_list: Cell>>, + pub attr_list: Cell>>, class_list: Cell>>, } @@ -535,7 +535,7 @@ impl<'a> ElementMethods for JSRef<'a, Element> { } // http://dom.spec.whatwg.org/#dom-element-attributes - fn Attributes(&self) -> Temporary { + fn Attributes(&self) -> Temporary { match self.attr_list.get() { None => (), Some(ref list) => return Temporary::new(list.clone()), @@ -546,7 +546,7 @@ impl<'a> ElementMethods for JSRef<'a, Element> { node.owner_doc().root() }; let window = doc.deref().window.root(); - let list = AttrList::new(&*window, self); + let list = NamedNodeMap::new(&*window, self); self.attr_list.assign(Some(list)); Temporary::new(self.attr_list.get().get_ref().clone()) } diff --git a/src/components/script/dom/attrlist.rs b/src/components/script/dom/namednodemap.rs similarity index 69% rename from src/components/script/dom/attrlist.rs rename to src/components/script/dom/namednodemap.rs index e4812b756c2..d60160133c9 100644 --- a/src/components/script/dom/attrlist.rs +++ b/src/components/script/dom/namednodemap.rs @@ -3,8 +3,8 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::attr::Attr; -use dom::bindings::codegen::Bindings::AttrListBinding; -use dom::bindings::codegen::Bindings::AttrListBinding::AttrListMethods; +use dom::bindings::codegen::Bindings::NamedNodeMapBinding; +use dom::bindings::codegen::Bindings::NamedNodeMapBinding::NamedNodeMapMethods; use dom::bindings::global::Window; use dom::bindings::js::{JS, JSRef, Temporary}; use dom::bindings::utils::{Reflectable, Reflector, reflect_dom_object}; @@ -12,26 +12,26 @@ use dom::element::Element; use dom::window::Window; #[deriving(Encodable)] -pub struct AttrList { +pub struct NamedNodeMap { reflector_: Reflector, owner: JS, } -impl AttrList { - pub fn new_inherited(elem: &JSRef) -> AttrList { - AttrList { +impl NamedNodeMap { + pub fn new_inherited(elem: &JSRef) -> NamedNodeMap { + NamedNodeMap { reflector_: Reflector::new(), owner: JS::from_rooted(elem), } } - pub fn new(window: &JSRef, elem: &JSRef) -> Temporary { - reflect_dom_object(box AttrList::new_inherited(elem), - &Window(*window), AttrListBinding::Wrap) + pub fn new(window: &JSRef, elem: &JSRef) -> Temporary { + reflect_dom_object(box NamedNodeMap::new_inherited(elem), + &Window(*window), NamedNodeMapBinding::Wrap) } } -impl<'a> AttrListMethods for JSRef<'a, AttrList> { +impl<'a> NamedNodeMapMethods for JSRef<'a, NamedNodeMap> { fn Length(&self) -> u32 { self.owner.root().attrs.borrow().len() as u32 } @@ -47,7 +47,7 @@ impl<'a> AttrListMethods for JSRef<'a, AttrList> { } } -impl Reflectable for AttrList { +impl Reflectable for NamedNodeMap { fn reflector<'a>(&'a self) -> &'a Reflector { &self.reflector_ } diff --git a/src/components/script/dom/webidls/Element.webidl b/src/components/script/dom/webidls/Element.webidl index 05caf6039a0..fc737bdb9ec 100644 --- a/src/components/script/dom/webidls/Element.webidl +++ b/src/components/script/dom/webidls/Element.webidl @@ -32,7 +32,7 @@ interface Element : Node { readonly attribute DOMTokenList classList; [Constant] - readonly attribute AttrList attributes; + readonly attribute NamedNodeMap attributes; DOMString? getAttribute(DOMString name); DOMString? getAttributeNS(DOMString? namespace, DOMString localName); [Throws] diff --git a/src/components/script/dom/webidls/AttrList.webidl b/src/components/script/dom/webidls/NamedNodeMap.webidl similarity index 87% rename from src/components/script/dom/webidls/AttrList.webidl rename to src/components/script/dom/webidls/NamedNodeMap.webidl index f9419f5ef62..636c4a2782f 100644 --- a/src/components/script/dom/webidls/AttrList.webidl +++ b/src/components/script/dom/webidls/NamedNodeMap.webidl @@ -2,8 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -[NoInterfaceObject] -interface AttrList { +interface NamedNodeMap { readonly attribute unsigned long length; getter Attr? item(unsigned long index); }; diff --git a/src/components/script/script.rs b/src/components/script/script.rs index f524fefe0f0..69ffc2fa59b 100644 --- a/src/components/script/script.rs +++ b/src/components/script/script.rs @@ -76,7 +76,6 @@ pub mod dom { pub mod macros; pub mod attr; - pub mod attrlist; pub mod blob; pub mod browsercontext; pub mod canvasrenderingcontext2d; @@ -173,6 +172,7 @@ pub mod dom { pub mod location; pub mod messageevent; pub mod mouseevent; + pub mod namednodemap; pub mod navigator; pub mod node; pub mod nodeiterator; diff --git a/src/test/content/test_interfaces.html b/src/test/content/test_interfaces.html index 54306780e3e..8f257704d38 100644 --- a/src/test/content/test_interfaces.html +++ b/src/test/content/test_interfaces.html @@ -144,6 +144,7 @@ var interfaceNamesInGlobalScope = [ "Location", "MessageEvent", "MouseEvent", + "NamedNodeMap", "Navigator", "Node", "NodeIterator", diff --git a/src/test/wpt/metadata/dom/historical.html.ini b/src/test/wpt/metadata/dom/historical.html.ini new file mode 100644 index 00000000000..b4a07190c07 --- /dev/null +++ b/src/test/wpt/metadata/dom/historical.html.ini @@ -0,0 +1,5 @@ +[historical.html] + type: testharness + [Historical DOM features must be removed: NamedNodeMap] + expected: FAIL +