Skip to content

Instantly share code, notes, and snippets.

@trknhr
Last active February 5, 2017 15:47
Show Gist options
  • Save trknhr/548ad22836bbdd4340789a2d48e472cd to your computer and use it in GitHub Desktop.
Save trknhr/548ad22836bbdd4340789a2d48e472cd to your computer and use it in GitHub Desktop.
<script>
class HelloWorld extends HTMLElement{
constructor(){
//always first
super()
const shadow = this.attachShadow({mode:'open'});
shadow.innerHTML =
`
<style>
.content {
font-weight: bold;
background: #F5F5F5;
}
</style>
<div class="content">Hello world</div>
`
}
}
customElements.define('hello-world', HelloWorld);
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment