Last active
April 7, 2019 10:49
-
-
Save mistyharsh/1f3c9388854044b28d78e443a1e81a34 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
class FancyComponent extends HTMLElement { | |
constructor() { | |
super(); | |
const shadowRoot = this.attachShadow({ mode: 'open' }); | |
shadowRoot.innerHTML = ` | |
<!-- Styles are scoped --> | |
<style> | |
p { color: red; } | |
</style> | |
<div> | |
<p>Hello World</p> | |
</div> | |
`; | |
} | |
} | |
customElements.define('fancy-comp', FacyComponent); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment