OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <script src="../../../resources/js-test.js"></script> |
| 3 <style> |
| 4 .c5 > .c4 ~ .c3 .c2 + .c1 { background-color: green } |
| 5 </style> |
| 6 <!-- |
| 7 Expected sets |
| 8 |
| 9 .c1 { } |
| 10 .c2 { subtree } |
| 11 .c3 { c1 } |
| 12 .c4 { subtree } |
| 13 .c5 { c1 } |
| 14 |
| 15 --> |
| 16 <div id="i5"> |
| 17 <div id="i4"></div> |
| 18 <div></div> |
| 19 <div></div> |
| 20 <div></div> |
| 21 <div id="i3"> |
| 22 <div> |
| 23 <div id="i2"></div> |
| 24 <div id="i1"> |
| 25 <div>This text should have a green background.</div> |
| 26 <span></span> |
| 27 <span></span> |
| 28 </div> |
| 29 </div> |
| 30 </div> |
| 31 </div> |
| 32 <script> |
| 33 description("Check that targeted class invalidation works with when adjacent com
binators are present."); |
| 34 |
| 35 var transparent = "rgba(0, 0, 0, 0)"; |
| 36 var green = "rgb(0, 128, 0)"; |
| 37 |
| 38 var i1 = document.getElementById("i1"); |
| 39 var i2 = document.getElementById("i2"); |
| 40 var i3 = document.getElementById("i3"); |
| 41 var i4 = document.getElementById("i4"); |
| 42 var i5 = document.getElementById("i5"); |
| 43 |
| 44 shouldBe("getComputedStyle(i1, null).backgroundColor", "transparent"); |
| 45 |
| 46 document.body.offsetTop; // Force style recalc. |
| 47 i1.className = "c1"; |
| 48 if (window.internals) |
| 49 shouldBe("internals.updateStyleAndReturnAffectedElementCount()", "1"); |
| 50 |
| 51 document.body.offsetTop; // Force style recalc. |
| 52 i2.className = "c2"; |
| 53 if (window.internals) |
| 54 shouldBe("internals.updateStyleAndReturnAffectedElementCount()", "1"); |
| 55 |
| 56 document.body.offsetTop; // Force style recalc. |
| 57 i3.className = "c3"; |
| 58 if (window.internals) |
| 59 shouldBe("internals.updateStyleAndReturnAffectedElementCount()", "2"); |
| 60 |
| 61 document.body.offsetTop; // Force style recalc. |
| 62 i4.className = "c4"; |
| 63 if (window.internals) |
| 64 shouldBe("internals.updateStyleAndReturnAffectedElementCount()", "1"); |
| 65 |
| 66 shouldBe("getComputedStyle(i1, null).backgroundColor", "transparent"); |
| 67 |
| 68 document.body.offsetLeft; // force style recalc. |
| 69 i5.className = "c5"; |
| 70 if (window.internals) |
| 71 shouldBe("internals.updateStyleAndReturnAffectedElementCount()", "2"); |
| 72 |
| 73 shouldBe("getComputedStyle(i1, null).backgroundColor", "green"); |
| 74 |
| 75 </script> |
OLD | NEW |