<my-component>World</my-component>
<div is="my-component">World</div>
<div id="lol"></div>
<script>
customElements.define(
'my-component',
class extends HTMLElement {
constructor() {
super()
this.innerHTML = `Hello ${this.innerHTML}`
}
}
);
setTimeout(() => {
document.querySelector('#lol').innerHTML = `<div is="my-component">LOL</div>`
}, 1000)
</script>