Document: customElementRegistry property - Web APIs | MDN

Value

A CustomElementRegistry object, or null.

Examples

Accessing a document's custom element registry

This example shows that the main document's customElementRegistry is the same global registry available through window.customElements, while documents created programmatically via DOMImplementation.createHTMLDocument() have a null registry by default.

js

// The main document's registry is the global one:
console.log(document.customElementRegistry === window.customElements); // true (for Window-associated documents)

// Documents created programmatically have a null registry:
const newDoc = document.implementation.createHTMLDocument("New document");
console.log(newDoc.customElementRegistry); // null

Specifications

Specification
DOM
# dom-documentorshadowroot-customelementregistry

Browser compatibility

See also

Help improve MDN

Learn how to contribute

This page was last modified on by MDN contributors.