diff options
Diffstat (limited to 'components/script/dom/htmlbodyelement.rs')
-rw-r--r-- | components/script/dom/htmlbodyelement.rs | 10 |
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), } |