diff options
Diffstat (limited to 'tests.mjs')
| -rw-r--r-- | tests.mjs | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -5,12 +5,16 @@ customElements.define('x-string', class extends HTMLElement { constructor() { super(); console.debug('x-string#constructor', this); - const template = this.querySelector('template').content; - const shadowRoot = this.attachShadow({mode: 'open'}).appendChild(template.cloneNode(true)); - console.debug('attached', template, 'to shadow root', shadowRoot); this.muted.onclick = this.muteClicked.bind(this); this.tonic.onclick = this.fretClicked.bind(this); + this.attachShadow({mode: 'open'}); + } + + connectedCallback() { + const template = this.querySelector('template').content; + this.shadowRoot.appendChild(template.cloneNode(true)); + console.debug('attached', template, 'to shadow root', shadowRoot); } get tonic() { |
