Element: customElementRegistry property

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

The customElementRegistry read-only property of the Element interface returns the CustomElementRegistry object associated with this element, or null if one has not been set.

An element's customElementRegistry is set when the element is created (for example, via Document.createElement() with the customElementRegistry option, or when parsed in a context that has a scoped registry). Once set to a CustomElementRegistry object, it cannot be changed. The registry determines which custom element definitions are used when the element is upgraded.

Value

A CustomElementRegistry object, or null.

Examples

Accessing an element's custom element registry

This example creates a scoped registry, attaches it to a shadow root, and then reads back the customElementRegistry property from an element inside the shadow tree to confirm it matches the scoped registry.

js
const myRegistry = new CustomElementRegistry();
myRegistry.define(
  "my-element",
  class extends HTMLElement {
    connectedCallback() {
      this.textContent = "Hello from scoped registry!";
    }
  },
);

const host = document.createElement("div");
document.body.appendChild(host);
const shadow = host.attachShadow({
  mode: "open",
  customElementRegistry: myRegistry,
});
shadow.innerHTML = "<my-element></my-element>";

const el = shadow.querySelector("my-element");
console.log(el.customElementRegistry === myRegistry); // true

Specifications

Specification
DOM
# dom-element-customelementregistry

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
Chrome – Full support
Chrome 146 (Release date: 2026-03-10)
footnote Full support
Edge – Full support
Edge 146 (Release date: 2026-03-13)
footnote Full support
Firefox – No support
Firefox 150 (Release date: 2026-04-21)
footnote , disabled
disabled From version 150 users must explicitly set the dom.scoped-custom-element-registries.enabled preference to true. To change preferences in Firefox, visit about:config.
footnote See bug 2018900
Opera – Full support
Opera 130 (Release date: 2026-04-08)
footnote Full support
Safari – Full support
Safari 26 (Release date: 2025-09-15)
footnote Full support
Chrome Android – Full support
Chrome Android 146 (Release date: 2026-03-10)
footnote Full support
Firefox for Android – No support
Firefox for Android
footnote No support
Opera Android – Full support
Opera Android 97 (Release date: 2026-04-16)
footnote Full support
Safari on iOS – Full support
Safari on iOS 26 (Release date: 2025-09-15)
footnote Full support
Samsung Internet – No support
Samsung Internet
footnote No support
WebView Android – Full support
WebView Android 146 (Release date: 2026-03-10)
footnote Full support
WebView on iOS – Full support
WebView on iOS 26 (Release date: 2025-09-15)
footnote Full support

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support
See implementation notes.
User must explicitly enable this feature.

See also