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.
constructor = customElements.get(name);
The constructor for the named custom element, or undefined
if there is no custom element definition for the name.
const BasicElement = customElements.get('basic-element'); if (BasicElement) { var newElement = new BasicElement(); }
Feature | Firefox (Gecko) | Chrome | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
Basic support | 52 (52) | 54 | No support | 41 | WebKit nightly |
Feature | Firefox Mobile (Gecko) | Chrome for Android | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|
Basic support | 52.0 (52) | 54 | No support | 41 | No support |
© 2005–2017 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