mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
auto merge of #2491 : saneyuki/servo/attr, r=jdm
This commit is contained in:
commit
2717ab65ec
1 changed files with 12 additions and 9 deletions
|
@ -229,15 +229,18 @@ pub trait AttributeHandlers {
|
||||||
|
|
||||||
impl<'a> AttributeHandlers for JSRef<'a, Element> {
|
impl<'a> AttributeHandlers for JSRef<'a, Element> {
|
||||||
fn get_attribute(&self, namespace: Namespace, name: &str) -> Option<Temporary<Attr>> {
|
fn get_attribute(&self, namespace: Namespace, name: &str) -> Option<Temporary<Attr>> {
|
||||||
if self.html_element_in_html_document() {
|
let element: &Element = self.deref();
|
||||||
self.deref().attrs.iter().map(|attr| attr.root()).find(|attr| {
|
let is_html_element = self.html_element_in_html_document();
|
||||||
name.to_ascii_lower() == attr.local_name && attr.namespace == namespace
|
|
||||||
}).map(|x| Temporary::from_rooted(&*x))
|
element.attrs.iter().map(|attr| attr.root()).find(|attr| {
|
||||||
} else {
|
let same_name = if is_html_element {
|
||||||
self.deref().attrs.iter().map(|attr| attr.root()).find(|attr| {
|
name.to_ascii_lower() == attr.local_name
|
||||||
name == attr.local_name && attr.namespace == namespace
|
} else {
|
||||||
}).map(|x| Temporary::from_rooted(&*x))
|
name == attr.local_name
|
||||||
}
|
};
|
||||||
|
|
||||||
|
same_name && attr.namespace == namespace
|
||||||
|
}).map(|x| Temporary::from_rooted(&*x))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_attribute_from_parser(&mut self, local_name: DOMString,
|
fn set_attribute_from_parser(&mut self, local_name: DOMString,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue