Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!DOCTYPE html> | |
| 2 <html> | |
| 3 <body> | |
|
esprehn
2014/03/03 21:01:45
I'd omit the <html> and <body> elements.
| |
| 4 <script src="../../../resources/js-test.js"></script> | |
| 5 | |
| 6 <link id="owningLink" rel="import" href="resources/style-target-blue.html"> | |
| 7 | |
| 8 <style id="styleRed"> | |
| 9 .target1, .target2, .target3 { | |
| 10 color: red; | |
| 11 } | |
| 12 </style> | |
| 13 | |
| 14 <link id="sharedLink" rel="import" href="resources/style-target-blue.html"> | |
| 15 | |
| 16 <style id="styleGreen"> | |
| 17 .target1 { | |
| 18 color: green; | |
| 19 } | |
| 20 </style> | |
| 21 | |
| 22 <div id="placeholder"></div> | |
| 23 | |
| 24 <span id="target1" class="target1">Hello!</span> | |
| 25 <span id="target2" class="target2">Hello!</span> | |
| 26 <span id="target3" class="target3">Hello!</span> | |
| 27 | |
| 28 <script> | |
| 29 function colorOf(element) | |
| 30 { | |
| 31 return window.getComputedStyle(element).color; | |
| 32 } | |
| 33 | |
| 34 // owninigLink, styleRed, styleGreen | |
| 35 | |
| 36 shouldBe("colorOf(target1)", "'rgb(0, 128, 0)'"); | |
| 37 shouldBe("colorOf(target2)", "'rgb(255, 0, 0)'"); | |
| 38 shouldBe("colorOf(target3)", "'rgb(255, 0, 0)'"); | |
| 39 | |
| 40 var owningLinkElement = document.getElementById("owningLink"); | |
| 41 document.body.removeChild(owningLinkElement); | |
| 42 | |
| 43 // styleRed, sharedLink, styleGreen | |
| 44 | |
| 45 shouldBe("colorOf(target1)", "'rgb(0, 128, 0)'"); | |
| 46 shouldBe("colorOf(target2)", "'rgb(0, 0, 255)'"); | |
| 47 shouldBe("colorOf(target3)", "'rgb(255, 0, 0)'"); | |
| 48 | |
| 49 document.body.insertBefore(owningLinkElement, placeholder); | |
| 50 | |
| 51 // styleRed, sharedLink, styleGreen - owningLinkElement shouldn't affect others | |
| 52 | |
| 53 shouldBe("colorOf(target1)", "'rgb(0, 128, 0)'"); | |
| 54 shouldBe("colorOf(target2)", "'rgb(0, 0, 255)'"); | |
| 55 shouldBe("colorOf(target3)", "'rgb(255, 0, 0)'"); | |
| 56 | |
| 57 </script> | |
| 58 | |
| 59 </body> | |
| 60 </html> | |
| OLD | NEW |