OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <script src="../../../resources/testharness.js"></script> | 2 <script src="../../../resources/testharness.js"></script> |
3 <script src="../../../resources/testharnessreport.js"></script> | 3 <script src="../../../resources/testharnessreport.js"></script> |
4 <style> | 4 <style> |
5 /* Dummy rule for increasing max-direct-adjacent */ | 5 /* Dummy rule for increasing max-direct-adjacent */ |
6 .x + .x + .x + .x { color: red } | 6 .x + .x + .x + .x { color: red } |
7 | 7 |
8 span { color: green } | 8 span, .p + .r { color: green } |
9 .a + .d, .b + .c { color: red } | 9 .a + .d, .b + .c, .r { color: red } |
10 </style> | 10 </style> |
11 <div id="insertTest"> | 11 <div id="insertTest"> |
12 <span class="a"></span> | 12 <span class="a"></span> |
13 <span class="b"></span> | 13 <span class="b"></span> |
14 <span class="c"></span> | 14 <span class="c"></span> |
15 <span class="d"></span> | 15 <span class="d"></span> |
16 </div> | 16 </div> |
17 <div id="removeTest"> | 17 <div id="removeTest"> |
18 <span class="a"></span> | 18 <span class="a"></span> |
| 19 <span class="a2"></span> |
19 <span class="b"></span> | 20 <span class="b"></span> |
20 <span class="c"></span> | 21 <span class="c"></span> |
21 <span class="d"></span> | 22 <span class="d"></span> |
22 </div> | 23 </div> |
| 24 <div id="removeTest2"> |
| 25 <span class="p"></span> |
| 26 <span class="q"></span> |
| 27 <span class="r"></span> |
| 28 </div> |
23 <script> | 29 <script> |
24 test(() => | 30 test(() => |
25 assert_not_equals(window.internals, undefined, "Check that window.intern
als is defined.") | 31 assert_not_equals(window.internals, undefined, "Check that window.intern
als is defined.") |
26 , "window.internals required for tests."); | 32 , "window.internals required for tests."); |
27 | 33 |
28 test(() => { | 34 test(() => { |
29 var c = insertTest.querySelector(".c"); | 35 var c = insertTest.querySelector(".c"); |
30 assert_equals(getComputedStyle(c).color, "rgb(255, 0, 0)", "Check that .
c is initially red."); | 36 assert_equals(getComputedStyle(c).color, "rgb(255, 0, 0)", "Check that .
c is initially red."); |
31 | 37 |
32 insertTest.insertBefore(document.createElement("span"), c); | 38 insertTest.insertBefore(document.createElement("span"), c); |
33 | 39 |
34 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 2, "
Recalc for the inserted element and .c."); | 40 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 2, "
Recalc for the inserted element and .c."); |
35 assert_equals(getComputedStyle(c).color, "rgb(0, 128, 0)", "Check that .
c is green after insertion."); | 41 assert_equals(getComputedStyle(c).color, "rgb(0, 128, 0)", "Check that .
c is green after insertion."); |
36 }, "Check that we don't invalidate too much on sibling insertion."); | 42 }, "Check that we don't invalidate too much on sibling insertion."); |
37 | 43 |
38 test(() => { | 44 test(() => { |
39 var c = removeTest.querySelector(".c"); | 45 var c = removeTest.querySelector(".c"); |
40 assert_equals(getComputedStyle(c).color, "rgb(255, 0, 0)", "Check that .
c is initially red."); | 46 assert_equals(getComputedStyle(c).color, "rgb(255, 0, 0)", "Check that .
c is initially red."); |
41 | 47 |
42 removeTest.querySelector(".b").remove(); | 48 removeTest.querySelector(".b").remove(); |
43 | 49 |
44 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 1, "
Recalc for .c."); | 50 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 1, "
Recalc for .c."); |
45 assert_equals(getComputedStyle(c).color, "rgb(0, 128, 0)", "Check that .
c is green after .b is removed."); | 51 assert_equals(getComputedStyle(c).color, "rgb(0, 128, 0)", "Check that .
c is green after .b is removed."); |
46 }, "Check that we don't invalidate too much on sibling removal."); | 52 }, "Check that we don't invalidate too much on sibling removal."); |
| 53 |
| 54 test(() => { |
| 55 var r = removeTest2.querySelector(".r"); |
| 56 assert_equals(getComputedStyle(r).color, "rgb(255, 0, 0)", "Check that .
r is initially red."); |
| 57 |
| 58 removeTest2.querySelector(".q").remove(); |
| 59 |
| 60 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 1, "
Recalc for .r"); |
| 61 assert_equals(getComputedStyle(r).color, "rgb(0, 128, 0)", "Check that .
r is green after .q is removed."); |
| 62 }, "Check that we don't invalidate past removed element for sibling removal.
"); |
47 </script> | 63 </script> |
OLD | NEW |