Skip to content

Conversation

@ja-y-son
Copy link
Contributor

@ja-y-son ja-y-son commented Nov 19, 2025

As part of the effort to support null custom element registry elements without shadow DOM, we're updating the spec to allow the creation of element and shadowroot to use null as a valid argument and create null registry element and shadowroot.

Fixes #1413 partially. We need another PR to support element attribute for null custom element registry in addition to #1423.

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


Preview | Diff

@ja-y-son
Copy link
Contributor Author

@rniwa @annevk here's another PR from what we discussed.

May be a dumb question: with this change, we probably no longer want to use null as the default vaule for customElementRegistry in ShadowRootInit. In that case are we still accounting for the use case where developer passing in a ShadowRoot instance as the argument to attachShadow?

@rniwa
Copy link
Collaborator

rniwa commented Nov 19, 2025

You mean someone doing: host.attachShadow(anotherShadowRoot)? Given customElementRegistry property on ShadowRoot continue to return the custom element registry of the shadow root, I don't see how that'll be broken?

@sorvell
Copy link

sorvell commented Nov 19, 2025

This matches my understanding of the first set of changes proposed in #1413 (comment) and agreed to at TPAC. Good job!

rniwa added a commit to rniwa/web-platform-tests that referenced this pull request Nov 19, 2025
…ing null to createEleent and attachShadow per

whatwg/dom#1424

Also update the existing tests to account for the behavior differences.`
rniwa added a commit to rniwa/web-platform-tests that referenced this pull request Nov 19, 2025
…ing null to createEleent and attachShadow per

- whatwg/dom#1424
- whatwg/dom#1423

Also update the existing tests to account for the behavior differences.`
Copy link
Member

@annevk annevk left a comment

Choose a reason for hiding this comment

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

Looks good modulo (my) nits.

rniwa added a commit to rniwa/web-platform-tests that referenced this pull request Nov 19, 2025
…ing null to createEleent and attachShadow per

- whatwg/dom#1424
- whatwg/dom#1423

Also update the existing tests to account for the behavior differences.`
rniwa added a commit to web-platform-tests/wpt that referenced this pull request Nov 20, 2025
…ing null to createEleent and attachShadow per (#56108)

- whatwg/dom#1424
- whatwg/dom#1423

Also update the existing tests to account for the behavior differences.`
@annevk
Copy link
Member

annevk commented Nov 21, 2025

OP is just lacking implementation bugs at this point, unless you want to add more test coverage still?

@ja-y-son
Copy link
Contributor Author

Added the implementation bugs in OP and the test coverage should be good for now. This PR should be ready to land :)

… part of my earlier nits that went unaddressed)
@annevk
Copy link
Member

annevk commented Nov 24, 2025

While doing a final check here I noticed that the new logic would end up throwing for the combination of "is" and "customElementRegistry" way too often. While WebKit would not object to that, I doubt that was the intent. I pushed a commit to fix that (and also fix some remaining nits).

Did you not yet implement this change perhaps or do we not have good test coverage for this?

@ja-y-son
Copy link
Contributor Author

Thanks for catching that "is" and "customElementRegistry" combination issue and fixing the nits I missed before! We've yet to implement this change and that was indeed not intended.

@annevk annevk merged commit f156ec0 into whatwg:main Nov 25, 2025
2 checks passed
lando-prod-mozilla bot pushed a commit to mozilla-firefox/firefox that referenced this pull request Nov 25, 2025
…content attribute and specifying null to createEleent and attachShadow per, a=testonly

Automatic update from web-platform-tests
Add new tests for customelementregistry content attribute and specifying null to createEleent and attachShadow per (#56108)

- whatwg/dom#1424
- whatwg/dom#1423

Also update the existing tests to account for the behavior differences.`
--

wpt-commits: cc1c056521abd0ff97456455dbebe113617a2bc1
wpt-pr: 56108
i3roly pushed a commit to i3roly/firefox-dynasty that referenced this pull request Nov 25, 2025
…content attribute and specifying null to createEleent and attachShadow per, a=testonly

Automatic update from web-platform-tests
Add new tests for customelementregistry content attribute and specifying null to createEleent and attachShadow per (#56108)

- whatwg/dom#1424
- whatwg/dom#1423

Also update the existing tests to account for the behavior differences.`
--

wpt-commits: cc1c056521abd0ff97456455dbebe113617a2bc1
wpt-pr: 56108
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Allow elements with a null customElementRegistry without Shadow DOM

4 participants