Simplify the string handling in HTMLAnchorElement::activation_behavior.

This commit is contained in:
Ms2ger 2015-07-03 13:31:00 +02:00
parent 59ea4dbd21
commit 9f52ab11aa

View file

@ -141,14 +141,13 @@ impl<'a> Activatable for &'a HTMLAnchorElement {
//TODO: Step 4. Download the link is `download` attribute is set. //TODO: Step 4. Download the link is `download` attribute is set.
let attr = element.get_attribute(&ns!(""), &atom!("href")); if let Some(ref href) = element.get_attribute(&ns!(""), &atom!("href")) {
match attr { let mut value = href.r().Value();
Some(ref href) => { if let Some(suffix) = ismap_suffix {
let value = href.r().Value() + ismap_suffix.as_ref().map(|s| &**s).unwrap_or(""); value.push_str(&suffix);
debug!("clicked on link to {}", value);
doc.r().load_anchor_href(value);
} }
None => () debug!("clicked on link to {}", value);
doc.r().load_anchor_href(value);
} }
} }