Skip to content

Instantly share code, notes, and snippets.

@jhnns
Created August 19, 2018 18:14
Show Gist options
  • Save jhnns/f10858dcad4135063774eca8eccad396 to your computer and use it in GitHub Desktop.
Save jhnns/f10858dcad4135063774eca8eccad396 to your computer and use it in GitHub Desktop.
shadow-dom-example
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