CustomElementRegistry.get()

The get() method of the CustomElementRegistry interface returns the constructor for a previously-defined custom element.

This is an experimental technology
Because this technology's specification has not stabilized, check the compatibility table for usage in various browsers. Also note that the syntax and behavior of an experimental technology is subject to change in future versions of browsers as the specification changes.

Syntax

constructor = customElements.get(name);

Parameters

name
Name for the new custom element.

Return value

The constructor for the named custom element, or undefined if there is no custom element definition for the name.

Examples

const BasicElement = customElements.get('basic-element');
if (BasicElement) {
  var newElement = new BasicElement();
}

Browser compatibility

Feature Firefox (Gecko) Chrome Internet Explorer Opera Safari
Basic support 52 (52) 54 No support 41 WebKit nightly

Document Tags and Contributors

 Contributors to this page: chrisdavidmills, jpmedley, arthurevans
 Last updated by: chrisdavidmills,