tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit fdb97be043d89c37bbc0edd23ec97c3dfc11a877
parent becd9b31be634f6d0f6492b574a5dd4540c60a51
Author: Anne van Kesteren <annevk@annevk.nl>
Date:   Fri, 10 Oct 2025 07:49:50 +0000

Bug 1992958 [wpt PR 55248] - DOM: attachShadow()'s custom element registry, a=testonly

Automatic update from web-platform-tests
DOM: attachShadow()'s custom element registry

See https://github.com/whatwg/dom/issues/1407 for context.

--

wpt-commits: de9ff543b0f74812be3609be8db4f4fa7bbfac31
wpt-pr: 55248

Diffstat:
Mtesting/web-platform/tests/custom-elements/registries/ShadowRoot-init-customElementRegistry.html | 6+++---
Atesting/web-platform/tests/custom-elements/registries/ShadowRoot-init-declarative.html | 29+++++++++++++++++++++++++++++
2 files changed, 32 insertions(+), 3 deletions(-)

diff --git a/testing/web-platform/tests/custom-elements/registries/ShadowRoot-init-customElementRegistry.html b/testing/web-platform/tests/custom-elements/registries/ShadowRoot-init-customElementRegistry.html @@ -37,14 +37,14 @@ test(() => { const host = document.body.appendChild(document.createElement('div')); const shadowRoot = host.attachShadow({mode: 'closed', customElementRegistry: null}); assert_equals(shadowRoot.customElementRegistry, window.customElements); -}, 'attachShadow() should use the global registry when customElementRegistry is null'); +}, 'attachShadow() should use the global registry when customElementRegistry is null (host uses global registry)'); test(() => { const registry = new CustomElementRegistry; const host = document.body.appendChild(document.createElement('div', {customElementRegistry: registry})); const shadowRoot = host.attachShadow({mode: 'closed', customElementRegistry: null}); - assert_equals(shadowRoot.customElementRegistry, registry); -}, 'attachShadow() should use the shadow host\'s registry when customElementRegistry is null'); + assert_equals(shadowRoot.customElementRegistry, window.customElements); +}, 'attachShadow() should use the global registry when customElementRegistry is null (host uses custom registry)'); test(() => { const registry = new CustomElementRegistry; diff --git a/testing/web-platform/tests/custom-elements/registries/ShadowRoot-init-declarative.html b/testing/web-platform/tests/custom-elements/registries/ShadowRoot-init-declarative.html @@ -0,0 +1,29 @@ +<!doctype html> +<title>Scoped Custom Element Registries: declarative shadow root</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="host"> + <template shadowrootmode="open" shadowrootcustomelementregistry> + <custom-element></custom-element> + <div></div> + </template> +</div> +<script> +test(() => { + const customElement = host.shadowRoot.firstElementChild; + assert_equals(customElement.customElementRegistry, null); + customElement.attachShadow({ + mode: "open" + }); + assert_equals(customElement.shadowRoot.customElementRegistry, null); +}, "Custom element inside 'shadowrootcustomelementregistry' declarative shadow root"); + +test(() => { + const divElement = host.shadowRoot.lastElementChild; + assert_equals(divElement.customElementRegistry, null); + divElement.attachShadow({ + mode: "open" + }); + assert_equals(divElement.shadowRoot.customElementRegistry, null); +}, "Built-in element inside 'shadowrootcustomelementregistry' declarative shadow root"); +</script>