--- title: CustomElementRegistry.get() slug: Web/API/CustomElementRegistry/get tags: - API - CustomElementRegistry - Experimental - Method - Reference - Web Components - custom elements - get browser-compat: api.CustomElementRegistry.get ---
{{APIRef("CustomElementRegistry")}}
O get() é um método de {{domxref("CustomElementRegistry")}} a interface retorna um construtor para um elemento personalizado previamente definido.
constructor = customElements.get(name);
O construtor do elemento personalizado nomeado, ou undefinedse não há definição de elemento personalizado com esse nome.
customElements.define('my-paragraph',
class extends HTMLElement {
constructor() {
let templateContent = document.getElementById('my-paragraph').content;
super() // returns element this scope
.attachShadow({mode: 'open'}) // sets AND returns this.shadowRoot
.append(templateContent.cloneNode(true));
}
})
// Retorne uma referência ao construtor my-paragraph
let ctor = customElements.get('my-paragraph');
{{Compat}}