mirror of
https://github.com/servo/servo.git
synced 2025-06-24 17:14:33 +01:00
Make simple NodeLists use Vec.
This commit is contained in:
parent
a1ec0cec11
commit
674fd893cb
2 changed files with 4 additions and 4 deletions
|
@ -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) => {
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue