Skip to content

Instantly share code, notes, and snippets.

@freshcutdevelopment
Created September 6, 2017 10:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save freshcutdevelopment/640a0abdd78fa419b694a9f3e0e52c03 to your computer and use it in GitHub Desktop.
Save freshcutdevelopment/640a0abdd78fa419b694a9f3e0e52c03 to your computer and use it in GitHub Desktop.
Vanilla shadow DOM HTML snippet (Blog)
<html>
<head></head>
<body>
<p id="component-host"></p>
<script>
var shadowElement = document.querySelector('#component-host')
.attachShadow({mode: 'open'});
shadow.innerHTML = '<span>DOM subtree</span>';
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment