diff options
author | Fernando Jiménez Moreno <ferjmoreno@gmail.com> | 2019-06-18 12:36:25 +0200 |
---|---|---|
committer | Fernando Jiménez Moreno <ferjmoreno@gmail.com> | 2019-07-22 17:40:17 +0200 |
commit | ef02196dd8015d38fa5d30f0947be6d8e990b528 (patch) | |
tree | ddff34dd0c35ebdb15c2e6c96a590be536ea2033 /components/script/dom/shadowroot.rs | |
parent | d4be72d3867122b2d5b0ca6330772a97f4f479fa (diff) | |
download | servo-ef02196dd8015d38fa5d30f0947be6d8e990b528.tar.gz servo-ef02196dd8015d38fa5d30f0947be6d8e990b528.zip |
More detach shadow changes
Diffstat (limited to 'components/script/dom/shadowroot.rs')
-rw-r--r-- | components/script/dom/shadowroot.rs | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/components/script/dom/shadowroot.rs b/components/script/dom/shadowroot.rs index 11db6416f9f..d7fda201342 100644 --- a/components/script/dom/shadowroot.rs +++ b/components/script/dom/shadowroot.rs @@ -3,6 +3,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use crate::dom::bindings::cell::DomRefCell; +use crate::dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use crate::dom::bindings::codegen::Bindings::ShadowRootBinding::ShadowRootBinding::ShadowRootMethods; use crate::dom::bindings::codegen::Bindings::ShadowRootBinding::{self, ShadowRootMode}; use crate::dom::bindings::inheritance::Castable; @@ -78,13 +79,25 @@ impl ShadowRoot { } pub fn detach(&self) { - self.host.set(None); + self.document.unregister_shadow_root(&self); let node = self.upcast::<Node>(); node.set_containing_shadow_root(None); - node.set_flag(NodeFlags::IS_CONNECTED, false); for child in node.traverse_preorder(ShadowIncluding::No) { - child.set_flag(NodeFlags::IS_CONNECTED, false); + if node.RemoveChild(&child).is_err() { + warn!("Could not remove shadow root child"); + } + } + if self + .host + .get() + .unwrap() + .upcast::<Node>() + .RemoveChild(&node) + .is_err() + { + warn!("Could not detach shadow root"); } + self.host.set(None); } pub fn get_focused_element(&self) -> Option<DomRoot<Element>> { |