-
Notifications
You must be signed in to change notification settings - Fork 23.2k
Missing scoped custom element registries docs #43237
Description
MDN URL
https://developer.mozilla.org/en-US/docs/Web/API/CustomElementRegistry/CustomElementRegistry
What specific section or headline is this issue about?
Multiple
What information was incorrect, unhelpful, or incomplete?
Scoped custom element registries are very useful for consumers of web components, especially for those who use their own component libraries, or that import 3rd-party libraries.
Today, all components are registered into a single, global registry, which means that two different components can't use the same tagname (like <fancy-button>) without the page breaking.
Scoped custom element registries allow consumers to scope different custom elements to different documents, elements, or shadow roots.
This is useful, for example, when importing a 3rd-party component library, or when testing multiple versions of the same library side by side.
The scoped custom element registry feature is documented partially on MDN:
- Existing docs:
CustomElementRegistry()constructor, to create a new registry.initialize()method, to scope an element, shadow root, or document to a registry.shadowrootcustomelementregistryattribute, for scoping a registry to a declarative shadow DOM.customElementRegistryproperty on DOM elements, documents, and shadow roots, to check which registry is a thing associated to.
The following docs (at least) seem to be missing:
- Missing docs:
- The
customElementRegistryoption for theattachShadow()method: https://developer.mozilla.org/en-US/docs/Web/API/Element/attachShadow does not mention it- From @hamishwillee - will be added by Element.attachShadow() - doc for options.customElementRegistry #43593
- The
customElementRegistryoption for thedocument.createElement()method: https://developer.mozilla.org/en-US/docs/Web/API/Document/createElement#options does not mention it.- From @hamishwillee - was added in Ff149 allow more chars in attributes/element names #43350
- The
What did you expect to see?
Adequate docs for the missing pieces listed above.
Do you have any supporting links, references, or citations?
No response
Do you have anything more you want to share?
I think scoped custom element registries are already supported in Safari, and coming to Edge and Chrome 146. Not sure when individual pieces of the API shipped.