-
Notifications
You must be signed in to change notification settings - Fork 318
Closed
Labels
topic: custom elementsRelates to custom elements (as defined in DOM and HTML)Relates to custom elements (as defined in DOM and HTML)topic: shadowRelates to shadow trees (as defined in DOM)Relates to shadow trees (as defined in DOM)
Description
What is the issue with the DOM Standard?
When calling attachShadow without specified custom element registry, is the new shadow root supposed to inherit host's custom element registry or use the global registry?
From the first step in DOM spec:
"Let registry be this’s custom element registry."
It sounds like we are expecting the shadow root to inherit the host's custom element registry.
However, from this webkit issue, it sounds like this should not be the expected behavior and global registry should be used by default.
Looking at the current implementation in webkit (20623.1.7.19.1), the behavior aligns with the spec and inherits the host's custom element registry instead of the global one.
const scopedRegistry = new CustomElementRegistry();
const scopedElement = document.createElement('div', {customElementRegistry: scopedRegistry});
const shadowRoot = element.attachShadow({mode: 'closed'});
shadowRoot.customElementRegistry === scopedRegistry // true
shadowRoot.customElementRegistry === customElements // false
Would like to clarify the spec and the expected behavior.
Metadata
Metadata
Assignees
Labels
topic: custom elementsRelates to custom elements (as defined in DOM and HTML)Relates to custom elements (as defined in DOM and HTML)topic: shadowRelates to shadow trees (as defined in DOM)Relates to shadow trees (as defined in DOM)