Skip to content

Instantly share code, notes, and snippets.

@rileybathurst
Last active July 2, 2021 01:38
Show Gist options
  • Save rileybathurst/a94aa3a28204a1ebd11ffbbf4094ac83 to your computer and use it in GitHub Desktop.
Save rileybathurst/a94aa3a28204a1ebd11ffbbf4094ac83 to your computer and use it in GitHub Desktop.
const createH2 = () => {
const h2Element = document.createElement('h2');
h2Element.textContent = 'This is a Styled Custom Element';
return h2Element;
};
class OPENSHADOW extends HTMLElement {
constructor() {
super();
}
connectedCallback() {
this.appendChild(createH2());
}
}
customElements.define('open-shadow', OPENSHADOW);
// add in the <open-shadow /> element in the html and connect this js file to do the thing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment