From cc23a324e5eb4c7a7182c7c8bbe3126bec7977b8 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Sat, 26 Apr 2014 11:04:06 +0200 Subject: [PATCH] Make static HTMLCollections use Vec. --- src/components/script/dom/htmlcollection.rs | 3 ++- src/components/script/dom/htmlformelement.rs | 2 +- src/components/script/dom/htmlmapelement.rs | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/components/script/dom/htmlcollection.rs b/src/components/script/dom/htmlcollection.rs index 70a94b04f43..5d5f7de0ae0 100644 --- a/src/components/script/dom/htmlcollection.rs +++ b/src/components/script/dom/htmlcollection.rs @@ -26,7 +26,7 @@ impl, E> Encodable for ~CollectionFilter { #[deriving(Encodable)] pub enum CollectionTypeId { - Static(~[JS]), + Static(Vec>), Live(JS, ~CollectionFilter) } @@ -135,6 +135,7 @@ impl HTMLCollection { pub fn Item(&self, index: u32) -> Option> { match self.collection { Static(ref elems) => elems + .as_slice() .get(index as uint) .map(|elem| elem.clone()), Live(ref root, ref filter) => root.traverse_preorder() diff --git a/src/components/script/dom/htmlformelement.rs b/src/components/script/dom/htmlformelement.rs index c054d9232d9..bc04beabdb4 100644 --- a/src/components/script/dom/htmlformelement.rs +++ b/src/components/script/dom/htmlformelement.rs @@ -118,7 +118,7 @@ impl HTMLFormElement { // FIXME: https://github.com/mozilla/servo/issues/1844 let doc = self.htmlelement.element.node.owner_doc(); let doc = doc.get(); - HTMLCollection::new(&doc.window, Static(~[])) + HTMLCollection::new(&doc.window, Static(vec!())) } pub fn Length(&self) -> i32 { diff --git a/src/components/script/dom/htmlmapelement.rs b/src/components/script/dom/htmlmapelement.rs index 8f853386473..24bab61040e 100644 --- a/src/components/script/dom/htmlmapelement.rs +++ b/src/components/script/dom/htmlmapelement.rs @@ -54,6 +54,6 @@ impl HTMLMapElement { // FIXME: https://github.com/mozilla/servo/issues/1845 let doc = self.htmlelement.element.node.owner_doc(); let doc = doc.get(); - HTMLCollection::new(&doc.window, Static(~[])) + HTMLCollection::new(&doc.window, Static(vec!())) } }