Web APIs

CustomElementRegistry.get()

Try the free JavaScript compiler

Look up the constructor registered for a custom element name; unknown names return undefined. Example console output: true true.

Formal Syntax & Structure

javascript syntaxjavascript
customElements.get(name)

Parameters & Attributes

NameTypeDescription
namestringCustom element name.

Return Value

CustomElementConstructor or undefined

Registered constructor if any.

Working Example

Example Snippetjavascript
class LessonBadge extends HTMLElement{} customElements.define("lesson-badge",LessonBadge); console.log(customElements.get("lesson-badge")===LessonBadge,customElements.get("lesson-unknown")===undefined);
JavaScript Reference