Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save FrankDeGroot/e894f320e45d99c9578aa72283aeed39 to your computer and use it in GitHub Desktop.
Save FrankDeGroot/e894f320e45d99c9578aa72283aeed39 to your computer and use it in GitHub Desktop.
for (const template of document.getElementsByTagName("template")) {
customElements.define(
template.id,
class extends HTMLElement {
constructor() {
super();
this.attachShadow({
mode: "open"
}).appendChild(template.content.cloneNode(true));
}
}
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment