diff --git a/Libraries/LibWeb/DOM/Document.cpp b/Libraries/LibWeb/DOM/Document.cpp index b4c61fb3491..7e4d61d3182 100644 --- a/Libraries/LibWeb/DOM/Document.cpp +++ b/Libraries/LibWeb/DOM/Document.cpp @@ -4511,6 +4511,11 @@ GC::Ref Document::appropriate_template_contents_owner_document() if (document_type() == Type::HTML) new_document->set_document_type(Type::HTML); + // AD-HOC: Copy over the "allow declarative shadow roots" flag, otherwise no elements inside templates will + // be able to have declarative shadow roots. + // Spec issue: https://github.com/whatwg/html/issues/11955 + new_document->set_allow_declarative_shadow_roots(allow_declarative_shadow_roots()); + // 3. Set doc's associated inert template document to new doc. m_associated_inert_template_document = new_document; } diff --git a/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/attachShadow-with-ShadowRoot.txt b/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/attachShadow-with-ShadowRoot.txt index 5fdd2350d47..2c70fb40664 100644 --- a/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/attachShadow-with-ShadowRoot.txt +++ b/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/attachShadow-with-ShadowRoot.txt @@ -2,7 +2,6 @@ Harness status: OK Found 2 tests -1 Pass -1 Fail +2 Pass Pass can use ShadowRoot as options for attachShadow -Fail can use ShadowRoot in document fragment as options for attachShadow \ No newline at end of file +Pass can use ShadowRoot in document fragment as options for attachShadow \ No newline at end of file diff --git a/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/declarative/declarative-shadow-dom-basic.txt b/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/declarative/declarative-shadow-dom-basic.txt index d543fdf7b50..bb970d7b1bc 100644 --- a/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/declarative/declarative-shadow-dom-basic.txt +++ b/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/declarative/declarative-shadow-dom-basic.txt @@ -2,8 +2,7 @@ Harness status: OK Found 22 tests -18 Pass -4 Fail +22 Pass Pass Declarative Shadow DOM: Basic test Pass Declarative Shadow DOM: Feature detection Pass Shadowrootmode reflection @@ -19,10 +18,10 @@ Pass Declarative Shadow DOM: Missing closing tag Pass Declarative Shadow DOM: delegates focus attribute Pass Declarative Shadow DOM: clonable attribute Pass Declarative Shadow DOM: Multiple roots -Fail Declarative Shadow DOM: template containing declarative shadow root (with shadowrootclonable) -Fail Declarative Shadow DOM: template containing (deeply nested) declarative shadow root -Fail Declarative Shadow DOM: template containing a template containing declarative shadow root -Fail Declarative Shadow DOM: template containing declarative shadow root and UA shadow root +Pass Declarative Shadow DOM: template containing declarative shadow root (with shadowrootclonable) +Pass Declarative Shadow DOM: template containing (deeply nested) declarative shadow root +Pass Declarative Shadow DOM: template containing a template containing declarative shadow root +Pass Declarative Shadow DOM: template containing declarative shadow root and UA shadow root Pass Declarative Shadow DOM: template containing closed declarative shadow root and UA shadow root Pass Declarative Shadow DOM: declarative shadow roots are not supported by the template element Pass Declarative Shadow DOM: explicit test that exceptions are not thrown \ No newline at end of file