| Index: Source/core/dom/Element.cpp
|
| diff --git a/Source/core/dom/Element.cpp b/Source/core/dom/Element.cpp
|
| index 85e3cac75909a1c28968bc646f0ac8497a31723a..f1636c5f76c05f3f2850626f0ddef7971be0aa33 100644
|
| --- a/Source/core/dom/Element.cpp
|
| +++ b/Source/core/dom/Element.cpp
|
| @@ -1828,10 +1828,17 @@ PassRefPtrWillBeRawPtr<ShadowRoot> Element::createShadowRoot(const ScriptState*
|
| UseCounter::count(document(), UseCounter::ElementCreateShadowRootWithParameter);
|
|
|
| OriginsUsingFeatures::count(scriptState, document(), OriginsUsingFeatures::Feature::ElementCreateShadowRoot);
|
| - // TODO(kochi): Add support for closed shadow root. crbug.com/459136
|
| - if (shadowRootInitDict.hasMode() && shadowRootInitDict.mode() == "closed") {
|
| - exceptionState.throwDOMException(NotSupportedError, "Closed shadow root is not implemented yet.");
|
| - return nullptr;
|
| +
|
| + if (shadowRootInitDict.hasMode()) {
|
| + if (shadowRoot()) {
|
| + exceptionState.throwDOMException(InvalidStateError, "Shadow root cannot be created on a host which already hosts a shadow tree.");
|
| + return nullptr;
|
| + }
|
| + // TODO(kochi): Add support for closed shadow root. crbug.com/459136
|
| + if (shadowRootInitDict.mode() == "closed") {
|
| + exceptionState.throwDOMException(NotSupportedError, "Closed shadow root is not implemented yet.");
|
| + return nullptr;
|
| + }
|
| }
|
|
|
| RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = createShadowRoot(exceptionState);
|
|
|