The lovely people at Javascript.Info have an article about Custom HTML Elements that is better than this boilerplate: https://javascript.info/custom-elements
Custom HTML Elements FTW!
This is a boilerplate of the HTML Custom Element API: https://developer.mozilla.org/en-US/docs/Web/API/Window/customElements
"Living code explains itself, somewhat, but the real value is in having a haunted town full of horror stories." --𝙙𝙙𝙖𝙮
I use this instead of React, Vue or Angular. Yes, it won't scale because x.