Add support for LinkStyle's sheet getter on <style> and <link>

This commit is contained in:
Manish Goregaokar 2016-11-15 17:12:04 -08:00
parent 1d20d75cb2
commit 972e9ac0fb
5 changed files with 23 additions and 2 deletions

View file

@ -22,6 +22,7 @@ use dom::eventtarget::EventTarget;
use dom::globalscope::GlobalScope;
use dom::htmlelement::HTMLElement;
use dom::node::{Node, document_from_node, window_from_node};
use dom::stylesheet::StyleSheet as DOMStyleSheet;
use dom::virtualmethods::VirtualMethods;
use encoding::EncodingRef;
use encoding::all::UTF_8;
@ -452,4 +453,9 @@ impl HTMLLinkElementMethods for HTMLLinkElement {
// https://html.spec.whatwg.org/multipage/#dom-link-target
make_setter!(SetTarget, "target");
// https://drafts.csswg.org/cssom/#dom-linkstyle-sheet
fn GetSheet(&self) -> Option<Root<DOMStyleSheet>> {
self.get_cssom_stylesheet().map(Root::upcast)
}
}