зеркало из https://github.com/mozilla/gecko-dev.git
servo: Merge #8295 - Various cleanup (from Ms2ger:cleanup); r=jdm
Source-Repo: https://github.com/servo/servo Source-Revision: 1794e5875a1d1e61f00f7d0d0592fc5f7cd278d7
This commit is contained in:
Родитель
0df5833603
Коммит
bc120e03a7
|
@ -155,12 +155,12 @@ pub fn handle_modify_attribute(page: &Rc<Page>,
|
||||||
let node = find_node_by_unique_id(&*page, pipeline, node_id);
|
let node = find_node_by_unique_id(&*page, pipeline, node_id);
|
||||||
let elem = node.downcast::<Element>().expect("should be getting layout of element");
|
let elem = node.downcast::<Element>().expect("should be getting layout of element");
|
||||||
|
|
||||||
for modification in &modifications {
|
for modification in modifications {
|
||||||
match modification.newValue {
|
match modification.newValue {
|
||||||
Some(ref string) => {
|
Some(string) => {
|
||||||
let _ = elem.SetAttribute(modification.attributeName.clone(), string.clone());
|
let _ = elem.SetAttribute(modification.attributeName, string);
|
||||||
},
|
},
|
||||||
None => elem.RemoveAttribute(modification.attributeName.clone()),
|
None => elem.RemoveAttribute(modification.attributeName),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,10 +64,7 @@ impl DOMTokenListMethods for DOMTokenList {
|
||||||
// https://dom.spec.whatwg.org/#dom-domtokenlist-item
|
// https://dom.spec.whatwg.org/#dom-domtokenlist-item
|
||||||
fn Item(&self, index: u32) -> Option<DOMString> {
|
fn Item(&self, index: u32) -> Option<DOMString> {
|
||||||
self.attribute().and_then(|attr| {
|
self.attribute().and_then(|attr| {
|
||||||
let attr = attr.r();
|
attr.value().as_tokens().get(index as usize).map(|token| (**token).to_owned())
|
||||||
Some(attr.value().as_tokens()).and_then(|tokens| {
|
|
||||||
tokens.get(index as usize).map(|token| (**token).to_owned())
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче