diff --git a/src/components/script/dom/node.rs b/src/components/script/dom/node.rs index f323421a8d7..56b3b853b48 100644 --- a/src/components/script/dom/node.rs +++ b/src/components/script/dom/node.rs @@ -873,6 +873,20 @@ impl Node { self.first_child.is_some() } + // http://dom.spec.whatwg.org/#dom-node-childnodes + pub fn ChildNodes(&mut self, abstract_self: &JS) -> JS { + match self.child_list { + None => { + let doc = self.owner_doc(); + let doc = doc.get(); + let list = NodeList::new_child_list(&doc.window, abstract_self); + self.child_list = Some(list.clone()); + list + } + Some(ref list) => list.clone() + } + } + // http://dom.spec.whatwg.org/#dom-node-firstchild pub fn GetFirstChild(&self) -> Option> { self.first_child.clone() @@ -942,20 +956,6 @@ impl Node { } } - // http://dom.spec.whatwg.org/#dom-node-childnodes - pub fn ChildNodes(&mut self, abstract_self: &JS) -> JS { - match self.child_list { - None => { - let doc = self.owner_doc(); - let doc = doc.get(); - let list = NodeList::new_child_list(&doc.window, abstract_self); - self.child_list = Some(list.clone()); - list - } - Some(ref list) => list.clone() - } - } - // http://dom.spec.whatwg.org/#concept-node-adopt fn adopt(node: &mut JS, document: &JS) { // Step 1.