aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/element.rs
diff options
context:
space:
mode:
authorAnthony Ramine <n.oxyde@gmail.com>2017-10-15 10:59:01 +0200
committerAnthony Ramine <n.oxyde@gmail.com>2017-10-15 11:03:20 +0200
commitc7b1d3054f9e87cf7ae7b10df5fbf5a97f6448f4 (patch)
tree08886f4fabb29cac0b0ba7cb341477ab8f28a757 /components/script/dom/element.rs
parent8b366a7441a7a4febcb5e2047807f9ad447c7adb (diff)
downloadservo-c7b1d3054f9e87cf7ae7b10df5fbf5a97f6448f4.tar.gz
servo-c7b1d3054f9e87cf7ae7b10df5fbf5a97f6448f4.zip
Change AttrValue::Url to AttrValue::ResolvedUrl
There is actually only one attribute that can use that, the one for <body background>.
Diffstat (limited to 'components/script/dom/element.rs')
-rw-r--r--components/script/dom/element.rs28
1 files changed, 8 insertions, 20 deletions
diff --git a/components/script/dom/element.rs b/components/script/dom/element.rs
index f6e5357df10..2287dcedb9a 100644
--- a/components/script/dom/element.rs
+++ b/components/script/dom/element.rs
@@ -1306,26 +1306,13 @@ impl Element {
Some(attr) => attr,
None => return DOMString::new(),
};
- let value = attr.value();
- match *value {
- AttrValue::Url(ref value, _) => {
- // XXXManishearth this doesn't handle `javascript:` urls properly
- let base = document_from_node(self).base_url();
- let value = base.join(value)
- .map(|parsed| parsed.into_string())
- .unwrap_or_else(|_| value.clone());
- DOMString::from(value)
- },
- _ => panic!("attribute value should be AttrValue::Url(..)"),
- }
- }
-
- pub fn set_url_attribute(&self, local_name: &LocalName, value: DOMString) {
- let value = AttrValue::from_url(
- document_from_node(self).base_url(),
- value.into(),
- );
- self.set_attribute(local_name, value);
+ let value = &**attr.value();
+ // XXXManishearth this doesn't handle `javascript:` urls properly
+ let base = document_from_node(self).base_url();
+ let value = base.join(value)
+ .map(|parsed| parsed.into_string())
+ .unwrap_or_else(|_| value.to_owned());
+ DOMString::from(value)
}
pub fn get_string_attribute(&self, local_name: &LocalName) -> DOMString {
@@ -1334,6 +1321,7 @@ impl Element {
None => DOMString::new(),
}
}
+
pub fn set_string_attribute(&self, local_name: &LocalName, value: DOMString) {
assert!(*local_name == local_name.to_ascii_lowercase());
self.set_attribute(local_name, AttrValue::String(value.into()));