CKTIS / JavaScript
customElements.get — retrieve a custom element constructor
customElements.get(name) synchronously returns the constructor registered under a name, or undefined. It checks a registry definition, not whether an element exists in the document.
Version: ECMAScript and Web APIs; exact feature edition and browser support reviewed per entry; Node 24 in repository does not prove browser API support
Syntax
customElements.get(name)customElements.get(name) reads a definition from the window.customElements registry. It returns the registered constructor, or undefined when the name is absent. Matching is case-sensitive; the method does not lowercase the name.
The result is a constructor, not an instance or a list of DOM nodes. Calling the method does not create or register anything. It checks only the receiving registry, not every registry on the page.
The lookup is synchronous and does not wait for later registration. Use customElements.whenDefined(name) to wait. An unknown or invalid string name makes get() return undefined, rather than producing a name-validation error.
This is a Web API specified by the HTML Living Standard, not a feature of a particular ECMAScript edition. The standard's compatibility table lists Chrome 54+, Firefox 63+, and Safari 10.1+. Node 24 in a repository does not establish availability of this browser API.
Examples
(() => {
const name = 'cktis-get-demo';
console.log(customElements.get(name));
class DemoElement extends HTMLElement {}
customElements.define(name, DemoElement);
const Constructor = customElements.get(name);
console.log(Constructor === DemoElement);
console.log(new Constructor() instanceof DemoElement);
})();Result
undefined true true
The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.