Scala JS extending an HTMLElement to make a CustomElement
问题 Fiddling with ScalaJS, I am trying to achieve the following, ie. create a custom web component skeleton: class DocumentPreview extends HTMLElement { static get observedAttributes() { return []; } constructor() { super(); this.root = this.attachShadow({ mode: "open"}); } connectedCallback() { let x = document.querySelector('link[rel="import"]#templates').import; this.root.appendChild(x.querySelector("#document-preview").content.cloneNode(true)); } disconnectedCallback() { }