Last active
July 2, 2021 01:38
-
-
Save rileybathurst/a94aa3a28204a1ebd11ffbbf4094ac83 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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