CustomElementRegistry

Draft
This page is not complete.

The CustomElementRegistry interface provides methods for registering custom elements and querying registered elements. It can be accessed with window.customElements.

This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

Methods

CustomElementRegistry.define()
Defines a new custom element.
CustomElementRegistry.get()
Returns the constuctor for the named custom element, or undefined if the custom element is not defined.
CustomElementRegistry.whenDefined()
Returns a promise that will be fulfilled when a custom element becomes defined with the given name. (If such a custom element is already defined, the returned promise is immediately fulfilled.)

Examples

// `window.customElements` is an instance of `CustomElementRegistry`
window.customElements instanceof CustomElementRegistry // true

Specifications

Specification Status Comment
HTML Living Standard
The definition of 'CustomElementRegistry' in that specification.
Living Standard Initial definition.

Browser compatibility

 

FeatureChromeEdgeFirefoxInternet ExplorerOperaSafari
Basic support541 No2 Yes3 No41110.11
FeatureAndroid webviewChrome for AndroidEdge mobileFirefox for AndroidIE mobileOpera AndroidiOS Safari
Basic support561611 No2 ? No No10.11

1. Supports 'Autonomous custom elements' but not 'Customized built-in elements'

2. Under consideration

3. This feature is behind the dom.webcomponents.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.

 

Document Tags and Contributors

 Contributors to this page: fscholz, Jedipedia, snuggs, daytonlowell, chrisdavidmills, arthurevans
 Last updated by: fscholz,