W3cubDocs

/DOM

window.customElements

The window.customElements read-only property returns a reference to the CustomElementRegistry object, which can be used to register custom elements, and get information about registered custom elements.

Syntax

customElements = window.customElements

Examples

class BasicElement extends HTMLElement {
  connectedCallback() {
    this.textContent = 'Just a basic custom element.';
  }
}
customElements.define('basic-element', BasicElement);

Specification

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

Browser compatibility

Feature Firefox (Gecko) Chrome Edge Internet Explorer Opera Safari
window.customElements No support (Yes) No support ? ? ?
Feature Firefox Mobile (Gecko) Chrome for Android IE Mobile Opera Mobile Safari Mobile
window.customElements ? ? ? ? ?

© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/window/customElements