From 25357434e1c488cc3fd2fdd08cf87114e55244b3 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Sat, 26 Apr 2014 10:47:02 +0200 Subject: [PATCH] Make Element::attrs a Vec. --- src/components/script/dom/attrlist.rs | 2 +- src/components/script/dom/element.rs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/components/script/dom/attrlist.rs b/src/components/script/dom/attrlist.rs index 504009e0e6d..77b08c33be7 100644 --- a/src/components/script/dom/attrlist.rs +++ b/src/components/script/dom/attrlist.rs @@ -35,7 +35,7 @@ impl AttrList { } pub fn Item(&self, index: u32) -> Option> { - self.owner.get().attrs.get(index as uint).map(|x| x.clone()) + self.owner.get().attrs.as_slice().get(index as uint).map(|x| x.clone()) } pub fn IndexedGetter(&self, index: u32, found: &mut bool) -> Option> { diff --git a/src/components/script/dom/element.rs b/src/components/script/dom/element.rs index cb21e05b786..54aa1206efa 100644 --- a/src/components/script/dom/element.rs +++ b/src/components/script/dom/element.rs @@ -36,7 +36,7 @@ pub struct Element { pub local_name: DOMString, // TODO: This should be an atom, not a DOMString. pub namespace: Namespace, pub prefix: Option, - pub attrs: ~[JS], + pub attrs: Vec>, pub style_attribute: Option, pub attr_list: Option> } @@ -145,7 +145,7 @@ impl Element { local_name: local_name, namespace: namespace, prefix: prefix, - attrs: ~[], + attrs: vec!(), attr_list: None, style_attribute: None, } @@ -264,7 +264,7 @@ impl AttributeHandlers for JS { let idx = self.get().attrs.iter().position(cb); let (mut attr, set_type): (JS, AttrSettingType) = match idx { Some(idx) => { - let attr = self.get_mut().attrs[idx].clone(); + let attr = self.get_mut().attrs.get(idx).clone(); (attr, ReplacedAttr) } @@ -376,7 +376,7 @@ impl AttributeHandlers for JS { None => (), Some(idx) => { if namespace == namespace::Null { - let removed_raw_value = self.get().attrs[idx].get().Value(); + let removed_raw_value = self.get().attrs.get(idx).get().Value(); vtable_for(&node).before_remove_attr(local_name.clone(), removed_raw_value); }