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 No support 54 No support 41 10.1
Feature Firefox Mobile (Gecko) Chrome for Android IE Mobile Opera Mobile Safari Mobile
Basic support No support 54 No support 41 10.1

Document Tags and Contributors

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