Set self as containing_shadow_root for shadow roots

This commit is contained in:
Fernando Jiménez Moreno 2019-04-29 12:15:16 +02:00
parent 68bee1c771
commit 37e88e77cd
2 changed files with 3 additions and 8 deletions

View file

@ -497,6 +497,9 @@ impl Element {
// Steps 4, 5 and 6.
let shadow_root = ShadowRoot::new(self, &*self.node.owner_doc());
self.ensure_rare_data().shadow_root = Some(Dom::from_ref(&*shadow_root));
shadow_root
.upcast::<Node>()
.set_containing_shadow_root(&shadow_root);
if self.is_connected() {
self.node.owner_doc().register_shadow_root(&*shadow_root);