Move Node::Children to a better place.

This commit is contained in:
Ms2ger 2014-03-05 18:52:49 +01:00
parent 81ef420e3f
commit 22a6485708

View file

@ -873,6 +873,20 @@ impl Node {
self.first_child.is_some() self.first_child.is_some()
} }
// http://dom.spec.whatwg.org/#dom-node-childnodes
pub fn ChildNodes(&mut self, abstract_self: &JS<Node>) -> JS<NodeList> {
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 // http://dom.spec.whatwg.org/#dom-node-firstchild
pub fn GetFirstChild(&self) -> Option<JS<Node>> { pub fn GetFirstChild(&self) -> Option<JS<Node>> {
self.first_child.clone() 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<Node>) -> JS<NodeList> {
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 // http://dom.spec.whatwg.org/#concept-node-adopt
fn adopt(node: &mut JS<Node>, document: &JS<Document>) { fn adopt(node: &mut JS<Node>, document: &JS<Document>) {
// Step 1. // Step 1.