Skip to content

Instantly share code, notes, and snippets.

@Axure
Created February 9, 2018 06:15
Show Gist options
  • Save Axure/d5ef6239da1f159064983a5d53b947b1 to your computer and use it in GitHub Desktop.
Save Axure/d5ef6239da1f159064983a5d53b947b1 to your computer and use it in GitHub Desktop.
host in DOM
<button class="red">My Button</button>
<script>
var button = document.querySelector('button');
var root = button.createShadowRoot();
root.innerHTML = '<style>' +
':host { text-transform: uppercase; }' +
'</style>' +
'<content></content>';
console.log(root.host);
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment