class includeHTML extends HTMLElement { connectedCallback() { const src = this.getAttribute("src"); fetch(src).then(response => response.text()).then(data => this.outerHTML = data); } } export function registerIncludeComponent() { customElements.define("x-include", includeHTML); }