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 |