Skip to content

feat: support for scoped custom element registries #6638

Description

@mpesic

Prerequisites

Describe the Feature Request

Add support for scoped registries in dist-custom-elements and elsewhere.

Describe the Use Case

Custom elements let web app developers build, share, and reuse UI components with their unique behaviors, making development easier. But when your app brings together different sets of custom elements, things can get messy, and name collisions can occur. Scoped custom element registries solve this issue!

Describe Preferred Solution

Currently the defineCustomElement() method on compiled components references the global custom element registry. Users should be able to pass references to their scoped custom registries.

Users should be able to register two custom elements with the same tag in two scoped registries on the same page.

Describe Alternatives

No response

Related Code

No response

Additional Information

https://developer.mozilla.org/en-US/docs/Web/API/CustomElementRegistry/CustomElementRegistry

https://developer.chrome.com/blog/scoped-registries?hl=en

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Stencil v5This is slated for Stencil v5 (Release date TBD)

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions