W3cubDocs

/Web APIs

CustomElementRegistry

Baseline Widely available *

This feature is well established and works across many devices and browser versions. It’s been available across browsers since ⁨January 2020⁩.

* Some parts of this feature may have varying levels of support.

The CustomElementRegistry interface provides methods for registering custom elements and querying registered elements. To get an instance of it, use the window.customElements property.

Instance methods

CustomElementRegistry.define()

Defines a new custom element.

CustomElementRegistry.get()

Returns the constructor for the named custom element, or undefined if the custom element is not defined.

CustomElementRegistry.getName()

Returns the name for the already-defined custom element, or null if the custom element is not defined.

CustomElementRegistry.upgrade()

Upgrades a custom element directly, even before it is connected to its shadow root.

CustomElementRegistry.whenDefined()

Returns an empty Promise that resolves 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

See the Examples section in our guide to using custom elements.

Specifications

Browser compatibility

Desktop Mobile
Chrome Edge Firefox Opera Safari Chrome Android Firefox for Android Opera Android Safari on IOS Samsung Internet WebView Android WebView on iOS
CustomElementRegistry No No No No 26 No No No 26 No No 26
CustomElementRegistry 54 79 63 41 10.1 54 63 41 10.3 6.0 54 10.3
builtin_element_support 67 79 63 54 No 67 63 48 No 9.0 67 No
define 54 79 63 41 10.1 54 63 41 10.3 6.0 54 10.3
get 54 79 63 41
10.1Supports 'Autonomous custom elements' but not 'Customized built-in elements'. See bug 182671.
54 63 41
10.3Supports 'Autonomous custom elements' but not 'Customized built-in elements'. See bug 182671.
6.0 54
10.3Supports 'Autonomous custom elements' but not 'Customized built-in elements'. See bug 182671.
getName 117 117 116 103
17Supports 'Autonomous custom elements' but not 'Customized built-in elements'.
117 116 78
17Supports 'Autonomous custom elements' but not 'Customized built-in elements'.
24.0 117
17Supports 'Autonomous custom elements' but not 'Customized built-in elements'.
initialize No No No No 26 No No No 26 No No 26
upgrade 68 79 63 55 12.1 68 63 48 12.2 10.0 68 12.2
whenDefined 54 79 63 41 10.1 54 63 41 10.3 6.0 54 10.3

© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/CustomElementRegistry