W3cubDocs

/DOM

CustomElementRegistry.get

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

This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

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

© 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/CustomElementRegistry/get