class NameTag extends HTMLElement { // Assign a private variable to store the name property constructor() { super(); this._name = ''; this._rendered = false; } // Static method that returns an array with the name of // all the properties that should be observed static get observedAttributes() { return ["name"]; } // A lifecycle call back that gets invoked every time // a property in the observation list changes. This method // leaves room to do some dirty checking attributeChangedCallback(name, oldValue, newValue) { if (newValue !== oldValue && name === 'name') { this.name = newValue; } } render() { this._shadowRoot = this.attachShadow({mode: 'open'}); this._shadowRoot.innerHTML = `