mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-21 09:15:35 +00:00
Bug 1484040, unbind shadow DOM content when uninstalling shadow DOM based XML Pretty Printer, r=timdream
This commit is contained in:
parent
e50444f450
commit
9ea97a4cf5
@ -1275,7 +1275,8 @@ Element::AttachShadowWithoutNameChecks(ShadowRootMode aMode)
|
||||
void
|
||||
Element::UnattachShadow()
|
||||
{
|
||||
if (!GetShadowRoot()) {
|
||||
RefPtr<ShadowRoot> shadowRoot = GetShadowRoot();
|
||||
if (!shadowRoot) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1290,6 +1291,12 @@ Element::UnattachShadow()
|
||||
|
||||
// Simply unhook the shadow root from the element.
|
||||
MOZ_ASSERT(!GetShadowRoot()->HasSlots(), "Won't work when shadow root has slots!");
|
||||
for (nsIContent* child = shadowRoot->GetFirstChild(); child;
|
||||
child = child->GetNextSibling()) {
|
||||
child->UnbindFromTree(true, false);
|
||||
}
|
||||
|
||||
shadowRoot->SetIsComposedDocParticipant(false);
|
||||
SetShadowRoot(nullptr);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user