aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/htmlbodyelement.rs
diff options
context:
space:
mode:
authorAnthony Ramine <n.oxyde@gmail.com>2017-10-10 16:14:40 +0200
committerAnthony Ramine <n.oxyde@gmail.com>2017-10-11 13:56:07 +0200
commit605c679fee29302321878a74b88aa7165519b516 (patch)
treec52ffde5e21c61b3a5cbdc5aa308247741bb708d /components/script/dom/htmlbodyelement.rs
parent826352ab4cae13f5154d13ab53885d80a8057337 (diff)
downloadservo-605c679fee29302321878a74b88aa7165519b516.tar.gz
servo-605c679fee29302321878a74b88aa7165519b516.zip
Fix URL attributes
URL attributes should always use AttrValue::Url, and the input should be resolved against the document's base URL at setting time always.
Diffstat (limited to 'components/script/dom/htmlbodyelement.rs')
-rw-r--r--components/script/dom/htmlbodyelement.rs10
1 files changed, 8 insertions, 2 deletions
diff --git a/components/script/dom/htmlbodyelement.rs b/components/script/dom/htmlbodyelement.rs
index 53fb0637b0d..580dc0a8808 100644
--- a/components/script/dom/htmlbodyelement.rs
+++ b/components/script/dom/htmlbodyelement.rs
@@ -4,6 +4,7 @@
use cssparser::RGBA;
use dom::attr::Attr;
+use dom::bindings::codegen::Bindings::AttrBinding::AttrBinding::AttrMethods;
use dom::bindings::codegen::Bindings::HTMLBodyElementBinding::{self, HTMLBodyElementMethods};
use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods;
use dom::bindings::inheritance::Castable;
@@ -73,7 +74,12 @@ impl HTMLBodyElementMethods for HTMLBodyElement {
make_legacy_color_setter!(SetText, "text");
// https://html.spec.whatwg.org/multipage/#dom-body-background
- make_getter!(Background, "background");
+ fn Background(&self) -> DOMString {
+ self.upcast::<Element>()
+ .get_attribute(&ns!(), &local_name!("background"))
+ .map(|attr| attr.Value())
+ .unwrap_or_default()
+ }
// https://html.spec.whatwg.org/multipage/#dom-body-background
make_url_setter!(SetBackground, "background");
@@ -154,7 +160,7 @@ impl VirtualMethods for HTMLBodyElement {
local_name!("bgcolor") |
local_name!("text") => AttrValue::from_legacy_color(value.into()),
local_name!("background") => {
- AttrValue::from_url(document_from_node(self).url(), value.into())
+ AttrValue::from_url(document_from_node(self).base_url(), value.into())
},
_ => self.super_type().unwrap().parse_plain_attribute(name, value),
}