Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Web component custom elements
class XInfoCard extends HTMLElement{
// Monitor the 'message' attribute for changes.
static get observedAttributes() {return ['message']; }
// Respond to attribute changes.
attributeChangedCallback(attr, oldValue, newValue) {
if (attr == 'message') {
this.textContent = newValue;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment