mirror of
https://github.com/servo/servo.git
synced 2025-06-25 17:44:33 +01:00
Make static HTMLCollections use Vec.
This commit is contained in:
parent
251e22266e
commit
cc23a324e5
3 changed files with 4 additions and 3 deletions
|
@ -26,7 +26,7 @@ impl<S: Encoder<E>, E> Encodable<S, E> for ~CollectionFilter {
|
||||||
|
|
||||||
#[deriving(Encodable)]
|
#[deriving(Encodable)]
|
||||||
pub enum CollectionTypeId {
|
pub enum CollectionTypeId {
|
||||||
Static(~[JS<Element>]),
|
Static(Vec<JS<Element>>),
|
||||||
Live(JS<Node>, ~CollectionFilter)
|
Live(JS<Node>, ~CollectionFilter)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,6 +135,7 @@ impl HTMLCollection {
|
||||||
pub fn Item(&self, index: u32) -> Option<JS<Element>> {
|
pub fn Item(&self, index: u32) -> Option<JS<Element>> {
|
||||||
match self.collection {
|
match self.collection {
|
||||||
Static(ref elems) => elems
|
Static(ref elems) => elems
|
||||||
|
.as_slice()
|
||||||
.get(index as uint)
|
.get(index as uint)
|
||||||
.map(|elem| elem.clone()),
|
.map(|elem| elem.clone()),
|
||||||
Live(ref root, ref filter) => root.traverse_preorder()
|
Live(ref root, ref filter) => root.traverse_preorder()
|
||||||
|
|
|
@ -118,7 +118,7 @@ impl HTMLFormElement {
|
||||||
// FIXME: https://github.com/mozilla/servo/issues/1844
|
// FIXME: https://github.com/mozilla/servo/issues/1844
|
||||||
let doc = self.htmlelement.element.node.owner_doc();
|
let doc = self.htmlelement.element.node.owner_doc();
|
||||||
let doc = doc.get();
|
let doc = doc.get();
|
||||||
HTMLCollection::new(&doc.window, Static(~[]))
|
HTMLCollection::new(&doc.window, Static(vec!()))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn Length(&self) -> i32 {
|
pub fn Length(&self) -> i32 {
|
||||||
|
|
|
@ -54,6 +54,6 @@ impl HTMLMapElement {
|
||||||
// FIXME: https://github.com/mozilla/servo/issues/1845
|
// FIXME: https://github.com/mozilla/servo/issues/1845
|
||||||
let doc = self.htmlelement.element.node.owner_doc();
|
let doc = self.htmlelement.element.node.owner_doc();
|
||||||
let doc = doc.get();
|
let doc = doc.get();
|
||||||
HTMLCollection::new(&doc.window, Static(~[]))
|
HTMLCollection::new(&doc.window, Static(vec!()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue