-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[web components]: experiment with scoped custom element registry #17718
Comments
You may also be interested in seeing this: |
I've been researching this issue. I want to offer my notes on the topic for consideration and also offer myself and @andy-blum to be available for a call to discuss. I don't have a concrete path forward. My hope here is to offer info on what scoped custom element registries are (and what they are not) to help advance the dicussion. What are Scoped Custom Element RegistriesScoped Element Registries are an enhancement to the current
Given we’re using Lit, we typically interact with the The key thing to know is that browsers presently support only a single
Scoped Custom Element Registries is a proposed attempt to help with this by allowing multiple Custom Element Registries to be created. The steps would include:
With the ability to have custom elements define the custom elements they use in a new custom element registry, you can avoid polluting the global namespace unnecessarily, and thus avoid some types of namespace collisions. A common mis-conception (I had this coming into this issue), is that scoped custom element registries would somehow allow you to have multiple instances of When you think about it, this makes sense. Consider wanting two different versions of For any custom element using custom elements in it’s shadow DOM, you can use a scoped custom element registry in the parent, and avoid polluting the global custom element registry with the sub-custom-elements. In this way, higher level components, eg. Additional caveats / limitationsLet's say we decide to make use of scoped custom element registries. There are some additional caveats / limitations fo consider. Much of this was adapted from
Current State of WICG Proposal
Next stepsApologies for the brain dump. For me the thread that we might continue exploring is component self-registration. Self-registration is a side-effect, one that is leading to registry name collisions. Other library authors in the proposal thread (ref1, ref2) alluded to shifting the responsibilty of registration to the consumer. The consumer has ultimate authority over the global namespace, which still has to be managed and can't be completely avoided by using scoped custom element registries. |
Thank you for submitting a feature request. Your proposal is open and will soon be triaged by the Carbon team. |
As of Carbon for IBM.com v2, components in
@carbon/ibmdotcom-web-components
will get a new prefix (TBD). Anticipating registry clashes of different component versions (v2 -> v3) with the same name, a test should be done with this polyfill. More information about this proposal here proposal.The text was updated successfully, but these errors were encountered: