Implement 'background' IDL attribute on <body>

This commit is contained in:
Corey Farwell 2016-01-02 14:02:28 -08:00
parent c0835ec336
commit 9a1fd472ab
4 changed files with 12 additions and 136 deletions

View file

@ -84,6 +84,17 @@ impl HTMLBodyElementMethods for HTMLBodyElement {
fn SetOnstorage(&self, listener: Option<Rc<EventHandlerNonNull>>) {
window_from_node(self).SetOnstorage(listener)
}
// https://html.spec.whatwg.org/multipage/#dom-body-background
make_getter!(Background, "background");
// https://html.spec.whatwg.org/multipage/#dom-body-background
fn SetBackground(&self, value: DOMString) {
let document = document_from_node(self);
let base = document.url();
*self.background.borrow_mut() = base.join(&value).ok();
self.upcast::<Element>().set_string_attribute(&atom!("background"), value);
}
}
pub trait HTMLBodyElementLayoutHelpers {

View file

@ -23,5 +23,5 @@ partial interface HTMLBodyElement {
//[TreatNullAs=EmptyString] attribute DOMString aLink;
[TreatNullAs=EmptyString] attribute DOMString bgColor;
// attribute DOMString background;
attribute DOMString background;
};