OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <script src="../../../resources/js-test.js"></script> | 2 <script src="../../../resources/js-test.js"></script> |
3 <style> | 3 <style> |
4 .b { color: red } | 4 .b { color: red } |
5 .a + div .b { color: green } | 5 .a + div .b { color: green } |
6 </style> | 6 </style> |
7 <input type="text"></input> | 7 <input type="text"></input> |
8 <div> | 8 <div> |
9 <span class="b">Should be green</span> | 9 <span class="b">Should be green</span> |
10 <span></span> | 10 <span></span> |
11 <span></span> | 11 <span></span> |
12 <span></span> | 12 <span></span> |
13 </div> | 13 </div> |
14 <script> | 14 <script> |
15 description("A reattach should not discard a scheduled sibling invalidation.
"); | 15 description("A reattach should not discard a scheduled sibling invalidation.
"); |
16 | 16 |
17 var input = document.querySelector("input"); | 17 var input = document.querySelector("input"); |
18 | 18 |
19 shouldBeEqualToString("getComputedStyle(document.querySelector('.b')).color"
, "rgb(255, 0, 0)"); | 19 shouldBeEqualToString("getComputedStyle(document.querySelector('.b')).color"
, "rgb(255, 0, 0)"); |
20 | 20 |
21 // Force clean style+layout | 21 // Force clean style+layout |
22 input.offsetTop; | 22 input.offsetTop; |
23 | 23 |
24 // Schedule sibling invalidation set to invalidate span.b | 24 // Schedule sibling invalidation set to invalidate span.b |
25 input.className = "a"; | 25 input.className = "a"; |
26 | 26 |
27 // Trigger lazyReattachIfAttached() -> detach(). | 27 // Trigger lazyReattachIfAttached() -> detach(). |
28 document.querySelector("input").type = "button"; | 28 document.querySelector("input").type = "button"; |
29 | 29 |
30 // The expected count will be 2 when ContainerNode::checkForChildrenAdjacent
RuleChanges() | 30 // One for attaching the input, and one for the span.b recalc. |
31 // is removed. One for attaching the input, and one for the span.b recalc. | |
32 if (window.internals) | 31 if (window.internals) |
33 shouldBe("internals.updateStyleAndReturnAffectedElementCount()", "6"); | 32 shouldBe("internals.updateStyleAndReturnAffectedElementCount()", "2"); |
34 | 33 |
35 shouldBeEqualToString("getComputedStyle(document.querySelector('.b')).color"
, "rgb(0, 128, 0)"); | 34 shouldBeEqualToString("getComputedStyle(document.querySelector('.b')).color"
, "rgb(0, 128, 0)"); |
36 </script> | 35 </script> |
OLD | NEW |