Return None as style for elements not in a document

This commit is contained in:
David Zbarsky 2015-07-30 12:36:08 -04:00
parent acbca7b3aa
commit 36145d0686
2 changed files with 11 additions and 0 deletions

View file

@ -99,6 +99,11 @@ impl<'a> PrivateCSSStyleDeclarationHelpers for &'a CSSStyleDeclaration {
fn get_computed_style(self, property: &Atom) -> Option<DOMString> {
let owner = self.owner.root();
let node = NodeCast::from_ref(owner.r());
if !node.is_in_doc() {
// TODO: Node should be matched against the style rules of this window.
// Firefox is currently the only browser to implement this.
return None;
}
let addr = node.to_trusted_node_address();
window_from_node(owner.r()).resolved_style_query(addr, self.pseudo.clone(), property)
}