aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/element.rs
diff options
context:
space:
mode:
authorFernando Jiménez Moreno <ferjmoreno@gmail.com>2019-01-25 13:00:26 +0100
committerFernando Jiménez Moreno <ferjmoreno@gmail.com>2019-04-26 10:17:45 +0200
commit640fc04743e38491e582a6ba30ded5bebb0a3ebb (patch)
tree7afea3eec1f1638d44968de3cf63e26cc58d8727 /components/script/dom/element.rs
parent48975840dd3a4becfc5ee6adccabd303e06fc554 (diff)
downloadservo-640fc04743e38491e582a6ba30ded5bebb0a3ebb.tar.gz
servo-640fc04743e38491e582a6ba30ded5bebb0a3ebb.zip
Implement shadow-including root, set node as in doc when connected. Makes JS work in shadow trees
Diffstat (limited to 'components/script/dom/element.rs')
-rw-r--r--components/script/dom/element.rs9
1 files changed, 4 insertions, 5 deletions
diff --git a/components/script/dom/element.rs b/components/script/dom/element.rs
index 599efd4a8cc..20b51fbfaa1 100644
--- a/components/script/dom/element.rs
+++ b/components/script/dom/element.rs
@@ -14,7 +14,7 @@ use crate::dom::bindings::codegen::Bindings::ElementBinding::ElementMethods;
use crate::dom::bindings::codegen::Bindings::EventBinding::EventMethods;
use crate::dom::bindings::codegen::Bindings::FunctionBinding::Function;
use crate::dom::bindings::codegen::Bindings::HTMLTemplateElementBinding::HTMLTemplateElementMethods;
-use crate::dom::bindings::codegen::Bindings::NodeBinding::NodeMethods;
+use crate::dom::bindings::codegen::Bindings::NodeBinding::{GetRootNodeOptions, NodeMethods};
use crate::dom::bindings::codegen::Bindings::WindowBinding::WindowMethods;
use crate::dom::bindings::codegen::Bindings::WindowBinding::{ScrollBehavior, ScrollToOptions};
use crate::dom::bindings::codegen::UnionTypes::NodeOrString;
@@ -484,9 +484,6 @@ impl Element {
return Err(Error::InvalidState);
}
- self.upcast::<Node>()
- .set_flag(NodeFlags::IS_IN_SHADOW_TREE, true);
-
// Steps 4, 5 and 6.
Ok(self
.shadow_root
@@ -3293,7 +3290,9 @@ impl Element {
/// <https://dom.spec.whatwg.org/#connected>
pub fn is_connected(&self) -> bool {
let node = self.upcast::<Node>();
- let root = node.GetRootNode();
+ let mut options = GetRootNodeOptions::empty();
+ options.composed = true; // shadow included.
+ let root = node.GetRootNode(&options);
root.is::<Document>()
}