DOM Interfaces

CustomElementRegistry

Registry for associating valid custom-element names with constructors. The document’s global registry is exposed through window.customElements. Names must contain a hyphen and meet additional naming rules. A definition cannot be replaced under the same name; scoped registries are a separate newer feature. Example result: true.

Formal Syntax & Structure

html syntaxhtml
window.customElements

Return Value

CustomElementRegistry

Registry object.

Working Example

Example Snippethtml
<p>  Result:  <output id="result"></output></p><script>  const result = document.getElementById("result");  (async () => {  class DemoCard extends HTMLElement {}  customElements.define("demo-card", DemoCard);  result.textContent = customElements.get("demo-card") === DemoCard;  })().catch(error => { result.textContent = "Error: " + error.name; });</script>
HTML Reference