From 17956776738bb9c47778441856a42daa3fff58e6 Mon Sep 17 00:00:00 2001 From: Ardis Lu Date: Mon, 7 Jul 2025 19:17:17 -0700 Subject: [PATCH] Move instantiation logic to `connectedCallback` Reference: https://html.spec.whatwg.org/multipage/custom-elements.html#custom-element-conformance --- script.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/script.js b/script.js index 2393fe4..164b3c0 100644 --- a/script.js +++ b/script.js @@ -4,8 +4,7 @@ const invisibleCharacters = [9, 10, 11, 12, 13, 32, 127, 160, 173, 847, 1564, 44 const encoder = new TextEncoder(); customElements.define('al-point-visualization', class extends HTMLElement { - constructor() { - super(); + connectedCallback() { const template = document.querySelector('template').content; const shadowRoot = this.attachShadow({ mode: 'open' }); shadowRoot.appendChild(template.cloneNode(true)); -- 2.47.3