mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Make Element::attrs a Vec.
This commit is contained in:
parent
7346992981
commit
25357434e1
2 changed files with 5 additions and 5 deletions
|
@ -35,7 +35,7 @@ impl AttrList {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn Item(&self, index: u32) -> Option<JS<Attr>> {
|
pub fn Item(&self, index: u32) -> Option<JS<Attr>> {
|
||||||
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<JS<Attr>> {
|
pub fn IndexedGetter(&self, index: u32, found: &mut bool) -> Option<JS<Attr>> {
|
||||||
|
|
|
@ -36,7 +36,7 @@ pub struct Element {
|
||||||
pub local_name: DOMString, // TODO: This should be an atom, not a DOMString.
|
pub local_name: DOMString, // TODO: This should be an atom, not a DOMString.
|
||||||
pub namespace: Namespace,
|
pub namespace: Namespace,
|
||||||
pub prefix: Option<DOMString>,
|
pub prefix: Option<DOMString>,
|
||||||
pub attrs: ~[JS<Attr>],
|
pub attrs: Vec<JS<Attr>>,
|
||||||
pub style_attribute: Option<style::PropertyDeclarationBlock>,
|
pub style_attribute: Option<style::PropertyDeclarationBlock>,
|
||||||
pub attr_list: Option<JS<AttrList>>
|
pub attr_list: Option<JS<AttrList>>
|
||||||
}
|
}
|
||||||
|
@ -145,7 +145,7 @@ impl Element {
|
||||||
local_name: local_name,
|
local_name: local_name,
|
||||||
namespace: namespace,
|
namespace: namespace,
|
||||||
prefix: prefix,
|
prefix: prefix,
|
||||||
attrs: ~[],
|
attrs: vec!(),
|
||||||
attr_list: None,
|
attr_list: None,
|
||||||
style_attribute: None,
|
style_attribute: None,
|
||||||
}
|
}
|
||||||
|
@ -264,7 +264,7 @@ impl AttributeHandlers for JS<Element> {
|
||||||
let idx = self.get().attrs.iter().position(cb);
|
let idx = self.get().attrs.iter().position(cb);
|
||||||
let (mut attr, set_type): (JS<Attr>, AttrSettingType) = match idx {
|
let (mut attr, set_type): (JS<Attr>, AttrSettingType) = match idx {
|
||||||
Some(idx) => {
|
Some(idx) => {
|
||||||
let attr = self.get_mut().attrs[idx].clone();
|
let attr = self.get_mut().attrs.get(idx).clone();
|
||||||
(attr, ReplacedAttr)
|
(attr, ReplacedAttr)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -376,7 +376,7 @@ impl AttributeHandlers for JS<Element> {
|
||||||
None => (),
|
None => (),
|
||||||
Some(idx) => {
|
Some(idx) => {
|
||||||
if namespace == namespace::Null {
|
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);
|
vtable_for(&node).before_remove_attr(local_name.clone(), removed_raw_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue