Created
August 19, 2018 18:14
-
-
Save jhnns/f10858dcad4135063774eca8eccad396 to your computer and use it in GitHub Desktop.
shadow-dom-example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
customElements.define("my-bubble", class extends HTMLElement { | |
constructor() { | |
super(); | |
const template = document.getElementById("my-element-template").content; | |
const shadowRoot = this.attachShadow({mode: "open"}); | |
shadowRoot.appendChild(template.cloneNode(true)); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment