OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <style> |
| 5 span { border-color: lime ! important; } |
| 6 div { border-color: orange; } |
| 7 div#id2 { border-color: yellow; } |
| 8 </style> |
| 9 <script src="../../../resources/js-test.js"></script> |
| 10 </head> |
| 11 <body> |
| 12 <div> |
| 13 <style scoped> |
| 14 div { border-color: green ! important; } |
| 15 div { border-color: red; } |
| 16 div#id2 {border-color: purple; } |
| 17 </style> |
| 18 <div> |
| 19 <style scoped> |
| 20 div { border-color: blue; } |
| 21 </style> |
| 22 <div id="id1"></div> |
| 23 </div> |
| 24 <div> |
| 25 <style scoped> |
| 26 div#id2 { border-color: blue; } |
| 27 </style> |
| 28 <div id="id2"></div> |
| 29 </div> |
| 30 <div> |
| 31 <style scoped> |
| 32 div { border-color: blue; } |
| 33 </style> |
| 34 <div id="id3" style="border-color: red;"></div> |
| 35 </div> |
| 36 <div> |
| 37 <style scoped> |
| 38 div { border-color: blue !important; } |
| 39 </style> |
| 40 <div id="id4"></div> |
| 41 </div> |
| 42 </div> |
| 43 <div> |
| 44 <style scoped> |
| 45 span#id5 { border-color: blue; } |
| 46 </style> |
| 47 <span id="id5"></span> |
| 48 </div> |
| 49 <div> |
| 50 <style scoped> |
| 51 span { border-color: blue !important; } |
| 52 </style> |
| 53 <span id="id6"></span> |
| 54 </div> |
| 55 </body> |
| 56 <script> |
| 57 description("Test that rules in an inner scoped stylesheet don't override !impor
tant rules declared in an outer scoped stylesheet."); |
| 58 |
| 59 var target1 = document.getElementById("id1"); |
| 60 debug("Case1: The target element has any matched important rule declared in an o
uter scoped stylesheet, and the element also has any matched normal rule declare
d in an inner scoped stylesheet."); |
| 61 shouldBe('getComputedStyle(target1).borderColor', '"rgb(0, 128, 0)"'); |
| 62 |
| 63 debug("Case2: The target element has any matched important rule declared in an o
uter scoped stylesheet, and the element also has a matched normal ID rule declar
ed in an inner scoped stylesheet."); |
| 64 var target2 = document.getElementById("id2"); |
| 65 shouldBe('getComputedStyle(target2).borderColor', '"rgb(0, 128, 0)"'); |
| 66 |
| 67 debug("Case3: The target element has any matched important rule declared in an o
uter scoped stylesheet, and the element also has matched normal rules declared i
n an inner scoped stylesheet and in a STYLE attribute."); |
| 68 var target3 = document.getElementById("id3"); |
| 69 shouldBe('getComputedStyle(target3).borderColor', '"rgb(0, 128, 0)"'); |
| 70 |
| 71 debug("Case4: The target element has matched important rules. One is declared in
an outer scoped stylesheet and the other is declared in an inner scoped stylesh
eet."); |
| 72 var target4 = document.getElementById("id4"); |
| 73 shouldBe('getComputedStyle(target4).borderColor', '"rgb(0, 0, 255)"'); |
| 74 |
| 75 debug("Case5: The target element has any matched important rule declared in an a
uthor stylesheet, and the element also has matched normal rules declared in an i
nner scoped stylesheet."); |
| 76 var target5 = document.getElementById("id5"); |
| 77 shouldBe('getComputedStyle(target5).borderColor', '"rgb(0, 255, 0)"'); |
| 78 |
| 79 debug("Case6: The target element has matched important rules. One is declared in
an author stylesheet (not scoped) and the other is declared in a scoped stylesh
eet."); |
| 80 var target6 = document.getElementById("id6"); |
| 81 shouldBe('getComputedStyle(target6).borderColor', '"rgb(0, 0, 255)"'); |
| 82 </script> |
| 83 </html> |
OLD | NEW |