You can rewrite:
constructor() { super(); this.attachShadow({mode: 'open'}); const template = document.getElementById('carousel'); const clone = template.content.cloneNode(true); this.shadowRoot.appendChild(clone); }
to:
constructor() { const template = document.getElementById('carousel'); const clone = template.content.cloneNode(true); super() .attachShadow({mode: 'open'}) .append(clone); }
Dev.to: 5 more lessons after Web Components 101
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
You can rewrite:
to:
Dev.to: 5 more lessons after Web Components 101