OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <script src="../../../resources/js-test.js"></script> |
| 3 <style> |
| 4 /* Rule to set childrenAffectedByDirectAdjacentRules() on #parent */ |
| 5 div + #x { color: orange } |
| 6 |
| 7 /* Rule to cause subtree recalc on #c1 when className set to c1. */ |
| 8 .c1 * { background-color: green } |
| 9 |
| 10 /* Rule to cause subtree recalc on div sibling of #c2 when className set to c2.
*/ |
| 11 .c2 + div * { background-color: green } |
| 12 |
| 13 </style> |
| 14 <div id="parent"> |
| 15 <div id="c1"> |
| 16 <span>This text should be green</span> |
| 17 <span>This text should be green</span> |
| 18 </div> |
| 19 <div> |
| 20 <span></span> |
| 21 <span></span> |
| 22 </div> |
| 23 <div id="c2"> |
| 24 <span></span> |
| 25 <span></span> |
| 26 </div> |
| 27 <div> |
| 28 <span>This text should be green</span> |
| 29 <span>This text should be green</span> |
| 30 </div> |
| 31 <div> |
| 32 <span></span> |
| 33 <span></span> |
| 34 </div> |
| 35 <div id="x"></div> |
| 36 </div> |
| 37 <script> |
| 38 description("A subtree invalidation should not invalidation sibling forest"); |
| 39 |
| 40 var transparent = "rgba(0, 0, 0, 0)"; |
| 41 var green = "rgb(0, 128, 0)"; |
| 42 |
| 43 var c1Spans = c1.querySelectorAll("span"); |
| 44 shouldBe("getComputedStyle(c1Spans[0]).backgroundColor", "transparent"); |
| 45 shouldBe("getComputedStyle(c1Spans[1]).backgroundColor", "transparent"); |
| 46 |
| 47 var c2Spans = document.querySelectorAll("#c2 + div span"); |
| 48 shouldBe("getComputedStyle(c2Spans[0]).backgroundColor", "transparent"); |
| 49 shouldBe("getComputedStyle(c2Spans[1]).backgroundColor", "transparent"); |
| 50 |
| 51 document.body.offsetTop; // force recalc |
| 52 |
| 53 c1.className = "c1"; |
| 54 |
| 55 if (window.internals) |
| 56 shouldBe("internals.updateStyleAndReturnAffectedElementCount()", "3"); |
| 57 shouldBe("getComputedStyle(c1Spans[0]).backgroundColor", "green"); |
| 58 shouldBe("getComputedStyle(c1Spans[1]).backgroundColor", "green"); |
| 59 |
| 60 document.body.offsetTop; // force recalc |
| 61 |
| 62 c2.className = "c2"; |
| 63 |
| 64 if (window.internals) |
| 65 shouldBe("internals.updateStyleAndReturnAffectedElementCount()", "3"); |
| 66 shouldBe("getComputedStyle(c2Spans[0]).backgroundColor", "green"); |
| 67 shouldBe("getComputedStyle(c2Spans[1]).backgroundColor", "green"); |
| 68 |
| 69 </script> |
OLD | NEW |