Created
January 11, 2017 08:09
-
-
Save TakayoshiKochi/119ce0a174c6d0fef7fc0f1705349bc1 to your computer and use it in GitHub Desktop.
Style Sharing for Shadow DOM v1
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
<!doctype html> | |
<html> | |
<body> | |
</body> | |
<script> | |
'use strict'; | |
let host = document.createElement('div'); | |
const numChildren = 10000; | |
for (var i = 0; i < numChildren; ++i) { | |
let div = document.createElement('div'); | |
div.textContent = 'Hello'; | |
host.appendChild(div); | |
} | |
document.body.appendChild(host); | |
let root = host.attachShadow({mode: 'open'}); | |
root.innerHTML = ` | |
<style> | |
slot::slotted(div) { color: green; } | |
</style> | |
<slot></slot> | |
`; | |
</script> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment