Created
August 21, 2014 00:43
-
-
Save thesifter/1cb6540fd7588b48ee14 to your computer and use it in GitHub Desktop.
Illustrate style encapsulation in the Shadow DOM // source http://jsbin.com/cequn/2
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
<meta name="description" content="Illustrate style encapsulation in the Shadow DOM" /> | |
<script src="http://www.polymer-project.org/platform.js"></script> | |
<script src="http://www.polymer-project.org/polymer.js"></script> | |
<style> | |
div { | |
color: red !important; | |
} | |
</style> | |
<div>div (main page): I should be red</div> | |
<polymer-element name="my-element" noscript> | |
<template> | |
<style> | |
div { | |
color: hotpink; | |
} | |
polyfill-next-selector {content: 'p'} | |
::content p { | |
color: blue; | |
} | |
</style> | |
<div>div (shadow dom): I should be pink</div> | |
<p>p (shadow dom): I should be black</p> | |
<content></content> | |
</template> | |
</polymer-element> | |
<my-element> | |
<p>p (distributed node -rendered with template): I should be blue</p> | |
</my-element> | |
<div>div (main page): Guyyzz!! im still red</div> | |
<p>p (main page) unstyled but awesome</p> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment