← Back to release summary

Scoped Custom Element Registry

Category
DOM
Type
New or changed feature
Status
Proposed (Chrome Proposed)
Intent stage
Start prototyping

Summary

This feature allows for multiple custom element definitions for a single tag name to exist within a page to prevent custom element name conflicts when a web app uses libraries from multiple sources. This is achieved by allowing user code to create multiple custom element registries and associate them with tree scopes and elements that function as scoping object for custom element creation/definition/upgrade.

Motivation

It's quite common for web applications to contain libraries from multiple sources, whether from different teams, vendors, package managers, etc. These libraries must currently contend for the global shared resource that is the CustomElementRegistry. If more than one library (or more than one instance of a library) tries to define the same tag name, the application will fail.

Standards & signals

Explainers: https://github.com/WICG/webcomponents/blob/gh-pages/proposals/Scoped-Custom-Element-Registries.md https://github.com/whatwg/html/issues/10854

View on chromestatus.com