class MainWindow extends HTMLElement { static observedAttributes = ['title', 'description']; constructor() { super(); this.attachShadow({ mode: 'open' }); } connectedCallback() { this.render(); } attributeChangedCallback() { this.render(); } render() { const title = this.getAttribute('title') || "No title"; const description = this.getAttribute('description') || "No description"; this.shadowRoot.innerHTML = `

${title}

${description}

`; } } customElements.define('main-window', MainWindow);