mirror of
https://github.com/servo/servo.git
synced 2025-08-02 04:00:32 +01:00
Clean up HTMLImageElement::areas
This commit is contained in:
parent
dc3b32c853
commit
ad1e4475af
1 changed files with 10 additions and 17 deletions
|
@ -413,25 +413,18 @@ impl HTMLImageElement {
|
||||||
}
|
}
|
||||||
pub fn areas(&self) -> Option<Vec<Root<HTMLAreaElement>>> {
|
pub fn areas(&self) -> Option<Vec<Root<HTMLAreaElement>>> {
|
||||||
let elem = self.upcast::<Element>();
|
let elem = self.upcast::<Element>();
|
||||||
let usemap_attr;
|
let usemap_attr = match elem.get_attribute(&ns!(), &local_name!("usemap")) {
|
||||||
if elem.has_attribute(&LocalName::from("usemap")) {
|
Some(attr) => attr,
|
||||||
usemap_attr = elem.get_string_attribute(&local_name!("usemap"));
|
None => return None,
|
||||||
} else {
|
};
|
||||||
return None;
|
|
||||||
|
let value = usemap_attr.value();
|
||||||
|
let (first, last) = value.split_at(1);
|
||||||
|
|
||||||
|
if first != "#" || last.len() == 0 {
|
||||||
|
return None
|
||||||
}
|
}
|
||||||
|
|
||||||
let (first, last) = usemap_attr.split_at(1);
|
|
||||||
|
|
||||||
match first {
|
|
||||||
"#" => {},
|
|
||||||
_ => return None,
|
|
||||||
};
|
|
||||||
|
|
||||||
match last.len() {
|
|
||||||
0 => return None,
|
|
||||||
_ => {},
|
|
||||||
};
|
|
||||||
|
|
||||||
let map = self.upcast::<Node>()
|
let map = self.upcast::<Node>()
|
||||||
.following_siblings()
|
.following_siblings()
|
||||||
.filter_map(Root::downcast::<HTMLMapElement>)
|
.filter_map(Root::downcast::<HTMLMapElement>)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue