Issue #2135 - Bug 1453789: Remove Element.createShadowRoot

This commit is contained in:
FranklinDM 2023-03-04 00:32:21 +08:00 committed by roytam1
commit 45c179d01b
19 changed files with 25 additions and 521 deletions

View file

@ -1126,18 +1126,6 @@ Element::AttachShadow(const ShadowRootInit& aInit, ErrorResult& aError)
return nullptr;
}
return AttachShadowInternal(aInit.mMode == ShadowRootMode::Closed, aError);
}
already_AddRefed<ShadowRoot>
Element::CreateShadowRoot(ErrorResult& aError)
{
return AttachShadowInternal(false, aError);
}
already_AddRefed<ShadowRoot>
Element::AttachShadowInternal(bool aClosed, ErrorResult& aError)
{
/**
* 3. If context object is a shadow host, then throw
* an "InvalidStateError" DOMException.
@ -1183,8 +1171,9 @@ Element::AttachShadowInternal(bool aClosed, ErrorResult& aError)
* context object???s node document, host is context object,
* and mode is init???s mode.
*/
bool isClosed = (aInit.mMode == ShadowRootMode::Closed);
RefPtr<ShadowRoot> shadowRoot =
new ShadowRoot(this, aClosed, nodeInfo.forget(), protoBinding);
new ShadowRoot(this, isClosed, nodeInfo.forget(), protoBinding);
shadowRoot->SetIsComposedDocParticipant(IsInComposedDoc());