Skip to content

feat: support for scoped custom element registries #6638

@mpesic

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions