| OLD | NEW |
| (Empty) |
| 1 <!doctype html> | |
| 2 <html> | |
| 3 <head> | |
| 4 <script src="../../../resources/js-test.js"></script> | |
| 5 </head> | |
| 6 <body> | |
| 7 <div id="insert"></div> | |
| 8 <div> | |
| 9 <div> | |
| 10 <style scoped> | |
| 11 span { | |
| 12 color: grey; | |
| 13 } | |
| 14 </style> | |
| 15 <span id="target"></span> | |
| 16 </div> | |
| 17 <style scoped> | |
| 18 span { | |
| 19 border: 1px solid green; | |
| 20 } | |
| 21 </style> | |
| 22 </div> | |
| 23 <pre id='console'></pre> | |
| 24 <script> | |
| 25 var style = document.createElement('style'); | |
| 26 style.innerHTML = 'span { color: green; }'; | |
| 27 document.getElementById('insert').appendChild(style); | |
| 28 | |
| 29 function borderColor(id) { | |
| 30 return getComputedStyle(document.getElementById(id)).borderColor; | |
| 31 } | |
| 32 | |
| 33 description('Test a case whether order of scoping nodes is different from or
der of style elements.'); | |
| 34 shouldBe('document.styleSheets.length', '4'); | |
| 35 shouldBe('document.styleSheets[1].cssRules[0].cssText', '"span { color: gree
n; }"'); | |
| 36 shouldBe('document.styleSheets[2].cssRules[0].cssText', '"span { color: grey
; }"'); | |
| 37 shouldBe('document.styleSheets[3].cssRules[0].cssText', '"span { border: 1px
solid green; }"'); | |
| 38 shouldBe('borderColor("target")', '"rgb(0, 128, 0)"'); | |
| 39 </script> | |
| 40 </body> | |
| 41 </html> | |
| 42 | |
| OLD | NEW |