diff options
author | rohan.prinja <rohan.prinja@samsung.com> | 2015-11-03 19:01:23 +0900 |
---|---|---|
committer | rohan.prinja <rohan.prinja@samsung.com> | 2015-11-03 19:01:23 +0900 |
commit | 6e774ea6eb6d719b98f924ab5bd0629d92fb27d0 (patch) | |
tree | fa48b89bb313a2e9514124b556bbcff5ed526a0f /components/script/dom/nodelist.rs | |
parent | 7032a5d1dee9bb2ba0bee45f1fda984dadfa0609 (diff) | |
parent | 4f51710ed387baa1ad0a6e4cdb0fc5eee44093d5 (diff) | |
download | servo-6e774ea6eb6d719b98f924ab5bd0629d92fb27d0.tar.gz servo-6e774ea6eb6d719b98f924ab5bd0629d92fb27d0.zip |
merge from master
Diffstat (limited to 'components/script/dom/nodelist.rs')
-rw-r--r-- | components/script/dom/nodelist.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/components/script/dom/nodelist.rs b/components/script/dom/nodelist.rs index cf5da3b0a3f..6747ee5a948 100644 --- a/components/script/dom/nodelist.rs +++ b/components/script/dom/nodelist.rs @@ -51,6 +51,10 @@ impl NodeList { pub fn new_child_list(window: &Window, node: &Node) -> Root<NodeList> { NodeList::new(window, NodeListType::Children(ChildrenList::new(node))) } + + pub fn empty(window: &Window) -> Root<NodeList> { + NodeList::new(window, NodeListType::Simple(vec![])) + } } impl NodeListMethods for NodeList { @@ -66,7 +70,7 @@ impl NodeListMethods for NodeList { fn Item(&self, index: u32) -> Option<Root<Node>> { match self.list_type { NodeListType::Simple(ref elems) => { - elems.get(index as usize).map(|node| node.root()) + elems.get(index as usize).map(|node| Root::from_ref(&**node)) }, NodeListType::Children(ref list) => list.item(index), } |