Skip to content

Conversation

@annevk
Copy link
Member

@annevk annevk commented Jul 21, 2025

This preserves existing behavior. We throw exceptions in certain corner cases to give us some wiggle room in the future to change some of this around.

Corresponding HTML PR: whatwg/html#11472.

Tests: web-platform-tests/wpt#53791.

Fixes #1390.

(See WHATWG Working Mode: Changes for more details.)


Preview | Diff

@annevk annevk requested a review from keithamus July 21, 2025 12:07
annevk added a commit to whatwg/html that referenced this pull request Jul 21, 2025
Let the global custom element registry not escape its document for now. We throw an exception to give us some wiggle room in the future.

DOM issue and PR: whatwg/dom#1390 & whatwg/dom#1392.

Tests: TODO.
This preserves existing behavior. We throw exceptions in certain corner cases to give us some wiggle room in the future to change some of this around.

Corresponding HTML PR: TODO

Tests: web-platform-tests/wpt#53791.

Fixes #1390.
@annevk annevk force-pushed the annevk/scope-non-scoped branch from 5bb8690 to c431e0f Compare July 21, 2025 14:01
@annevk annevk requested review from domenic, foolip and mfreed7 July 22, 2025 10:19
Copy link
Member

@keithamus keithamus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@foolip foolip left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Editorially this LGTM. For implementer support I defer to @mfreed7.

<ol>
<li><p>Set <var>registry</var> to <var>init</var>["{{ShadowRootInit/customElementRegistry}}"].

<li><p>If <var>registry</var>'s <a for=CustomElementRegistry>is scoped</a> is false and
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Am I reading this correct that the only thing you can do with element.attachShadow({customElementRegistry: ...}) is to pass in the document's custom element registry, and anything else will throw an error? That makes it a boolean and practice, but I presume that this is a place where you're reserving some wiggle room for future changes?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can pass in document's custom element registry or a scoped custom element registry.

annevk added a commit to web-platform-tests/wpt that referenced this pull request Jul 23, 2025
Align with the changes in whatwg/dom#1392 and whatwg/html#11472, add many more tests, and correct several tests.
annevk added a commit to whatwg/html that referenced this pull request Jul 23, 2025
Let the global custom element registry not escape its document for now. We throw an exception to give us some wiggle room in the future.

DOM issue and PR: whatwg/dom#1390 & whatwg/dom#1392.

Tests: web-platform-tests/wpt#53791.
@annevk annevk merged commit 3d429ce into main Jul 23, 2025
2 checks passed
@annevk annevk deleted the annevk/scope-non-scoped branch July 23, 2025 06:31
lando-prod-mozilla bot pushed a commit to mozilla-firefox/firefox that referenced this pull request Jul 28, 2025
…s, a=testonly

Automatic update from web-platform-tests
DOM: Scoped Custom Element Registry update

Align with the changes in whatwg/dom#1392 and whatwg/html#11472, add many more tests, and correct several tests.
--

wpt-commits: 3039174912db3ed199ff9a8dddc9add246658ae1
wpt-pr: 53791
i3roly pushed a commit to i3roly/firefox-dynasty that referenced this pull request Jul 28, 2025
…s, a=testonly

Automatic update from web-platform-tests
DOM: Scoped Custom Element Registry update

Align with the changes in whatwg/dom#1392 and whatwg/html#11472, add many more tests, and correct several tests.
--

wpt-commits: 3039174912db3ed199ff9a8dddc9add246658ae1
wpt-pr: 53791
foolip pushed a commit to web-platform-tests/wpt that referenced this pull request Aug 13, 2025
Align with the changes in whatwg/dom#1392 and whatwg/html#11472, add many more tests, and correct several tests.
@annevk annevk added the topic: custom elements Relates to custom elements (as defined in DOM and HTML) label Oct 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

topic: custom elements Relates to custom elements (as defined in DOM and HTML)

Development

Successfully merging this pull request may close these issues.

CustomElementRegistry and adoption

4 participants