Last active
August 19, 2018 18:08
-
-
Save jhnns/afdf5ae7cf62fa36c180f410f14f65bf to your computer and use it in GitHub Desktop.
custom-element-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 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