Make simple NodeLists use Vec.

This commit is contained in:
Ms2ger 2014-04-26 11:33:52 +02:00
parent a1ec0cec11
commit 674fd893cb
2 changed files with 4 additions and 4 deletions

View file

@ -608,7 +608,7 @@ impl Document {
}
pub fn createNodeList(&self, callback: |node: &JS<Node>| -> bool) -> JS<NodeList> {
let mut nodes: ~[JS<Node>] = ~[];
let mut nodes = vec!();
match self.GetDocumentElement() {
None => {},
Some(root) => {

View file

@ -10,7 +10,7 @@ use dom::window::Window;
#[deriving(Encodable)]
pub enum NodeListType {
Simple(~[JS<Node>]),
Simple(Vec<JS<Node>>),
Children(JS<Node>)
}
@ -37,7 +37,7 @@ impl NodeList {
window, NodeListBinding::Wrap)
}
pub fn new_simple_list(window: &JS<Window>, elements: ~[JS<Node>]) -> JS<NodeList> {
pub fn new_simple_list(window: &JS<Window>, elements: Vec<JS<Node>>) -> JS<NodeList> {
NodeList::new(window, Simple(elements))
}
@ -55,7 +55,7 @@ impl NodeList {
pub fn Item(&self, index: u32) -> Option<JS<Node>> {
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)
}
}