Skip to content

Instantly share code, notes, and snippets.

@jhnns
Last active August 19, 2018 18:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jhnns/afdf5ae7cf62fa36c180f410f14f65bf to your computer and use it in GitHub Desktop.
Save jhnns/afdf5ae7cf62fa36c180f410f14f65bf to your computer and use it in GitHub Desktop.
custom-element-example
customElements.define("my-bubble", class extends HTMLElement {
constructor() {
super();
const template = document.getElementById("my-element-template").content;
const color = this.getAttribute("background") || "white";
template.querySelector(".bubble").style.background = color;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment