Implements Stylesheet.ownerNode

This commit is contained in:
Vincent Ricard 2020-10-08 22:30:22 +02:00
parent 406d15974f
commit e7199c029f
14 changed files with 72 additions and 39 deletions

View file

@ -5,8 +5,10 @@
use crate::dom::bindings::codegen::Bindings::StyleSheetBinding::StyleSheetMethods;
use crate::dom::bindings::inheritance::Castable;
use crate::dom::bindings::reflector::Reflector;
use crate::dom::bindings::root::DomRoot;
use crate::dom::bindings::str::DOMString;
use crate::dom::cssstylesheet::CSSStyleSheet;
use crate::dom::element::Element;
use dom_struct::dom_struct;
#[dom_struct]
@ -44,6 +46,11 @@ impl StyleSheetMethods for StyleSheet {
self.href.clone()
}
// https://drafts.csswg.org/cssom/#dom-stylesheet-ownernode
fn GetOwnerNode(&self) -> Option<DomRoot<Element>> {
self.downcast::<CSSStyleSheet>().and_then(|s| s.get_owner())
}
// https://drafts.csswg.org/cssom/#dom-stylesheet-title
fn GetTitle(&self) -> Option<DOMString> {
self.title.clone()