WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED INVALID
299300
Calling attachShadow does not inherit host customElementRegistry as expected
https://bugs.webkit.org/show_bug.cgi?id=299300
Summary
Calling attachShadow does not inherit host customElementRegistry as expected
Steve Orvell
Reported
2025-09-22 09:51:06 PDT
When `attachShadow` is called without a registry, the shadowRoot does not inherit the host's customElementRegistry. See reproduction:
https://codepen.io/Steve-Orvell/pen/xbZGxOW?editors=1000
This expectation is based on
https://dom.spec.whatwg.org/#dom-element-attachshadow
"The attachShadow(init) method steps are: Let registry be this’s custom element registry."
Attachments
Add attachment
proposed patch, testcase, etc.
Justin Fagnani
Comment 1
2025-09-22 10:25:44 PDT
The spec behavior seems wrong. If the custom element isn't passing a registry to attachShadow(), then presumably it's expecting use the global registry. Using its parent scope's registry would very easily break it as that scope might be missing custom element definitions from self-registering element dependencies.
Ryosuke Niwa
Comment 2
2025-09-22 15:26:09 PDT
attachShadow isn't supposed to inherit host's customElementRegistry.
Steve Orvell
Comment 3
2025-09-22 16:26:19 PDT
@Ryosuke 1. Can you explain the linked spec text? 2. Can you explain the inconsistency between a shadowRoot on a div and on an undefined custom element candidate in the linked repro?
Anne van Kesteren
Comment 4
2025-10-06 23:33:52 PDT
1. See
https://github.com/whatwg/dom/issues/1407
. 2. The patch for
bug 300027
did capture the test for the div element inside an "inert" shadow root itself getting a shadow root with a custom element registry. No fix for that yet though, but it seems wrong to track it as part of this bug which started out about something else.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug