From 674fd893cbea3b969863fbafbb1edebe920221e7 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Sat, 26 Apr 2014 11:33:52 +0200 Subject: [PATCH] Make simple NodeLists use Vec. --- src/components/script/dom/document.rs | 2 +- src/components/script/dom/nodelist.rs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/script/dom/document.rs b/src/components/script/dom/document.rs index 9f5b9ed15d9..4b026fdf1b9 100644 --- a/src/components/script/dom/document.rs +++ b/src/components/script/dom/document.rs @@ -608,7 +608,7 @@ impl Document { } pub fn createNodeList(&self, callback: |node: &JS| -> bool) -> JS { - let mut nodes: ~[JS] = ~[]; + let mut nodes = vec!(); match self.GetDocumentElement() { None => {}, Some(root) => { diff --git a/src/components/script/dom/nodelist.rs b/src/components/script/dom/nodelist.rs index 266be79ae68..8cd547c0195 100644 --- a/src/components/script/dom/nodelist.rs +++ b/src/components/script/dom/nodelist.rs @@ -10,7 +10,7 @@ use dom::window::Window; #[deriving(Encodable)] pub enum NodeListType { - Simple(~[JS]), + Simple(Vec>), Children(JS) } @@ -37,7 +37,7 @@ impl NodeList { window, NodeListBinding::Wrap) } - pub fn new_simple_list(window: &JS, elements: ~[JS]) -> JS { + pub fn new_simple_list(window: &JS, elements: Vec>) -> JS { NodeList::new(window, Simple(elements)) } @@ -55,7 +55,7 @@ impl NodeList { pub fn Item(&self, index: u32) -> Option> { match self.list_type { _ if index >= self.Length() => None, - Simple(ref elems) => Some(elems[index as uint].clone()), + Simple(ref elems) => Some(elems.get(index as uint).clone()), Children(ref node) => node.children().nth(index as uint) } }