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 .t1 .sibling + *, | 5 .t1 .sibling + *, |
6 .t2 .sibling ~ *, | 6 .t2 .sibling ~ *, |
7 .t3 .sibling + :hover, | 7 .t3 .sibling + :hover, |
8 .t4 + .sibling, | 8 .t4 + .sibling, |
9 .t5 + *, | 9 .t5 + *, |
10 .t6 ~ .sibling { background-color: rgb(0, 128, 0); } | 10 .t6 ~ .sibling, |
| 11 .t7 + * + * .child, |
| 12 .t8 + :-webkit-any(.sibling) * { background-color: rgb(0, 128, 0); } |
11 | 13 |
12 #r3 { width: 10px; height: 10px } | 14 #r3 { width: 10px; height: 10px } |
13 </style> | 15 </style> |
14 <div> | 16 <div> |
15 <div id="t1"> | 17 <div id="t1"> |
16 <div class="sibling"></div> | 18 <div class="sibling"></div> |
17 <div id="r1"></div> | 19 <div id="r1"></div> |
18 </div> | 20 </div> |
19 </div> | 21 </div> |
20 <div> | 22 <div> |
21 <div id="t2"> | 23 <div id="t2"> |
22 <div class="sibling"></div> | 24 <div class="sibling"></div> |
23 <div></div> | 25 <div></div> |
24 <div id="r2"></div> | 26 <div id="r2"></div> |
25 </div> | 27 </div> |
26 </div> | 28 </div> |
27 <div> | 29 <div> |
28 <div id="t3"> | 30 <div id="t3"> |
29 <div class="sibling"></div> | 31 <div class="sibling"></div> |
30 <div id="r3"></div> | 32 <div id="r3"></div> |
31 </div> | 33 </div> |
32 </div> | 34 </div> |
33 <div> | 35 <div> |
34 <div id="t4"></div> | 36 <div id="t4"></div> |
35 <div id="r4" class="sibling"> | 37 <div id="r4" class="sibling"> |
36 <div></div> | 38 <div></div> |
37 <div></div> | 39 <div></div> |
38 </div> | 40 </div> |
| 41 <div class="sibling"></div> |
39 </div> | 42 </div> |
40 <div> | 43 <div> |
41 <div id="t5"></div> | 44 <div id="t5"></div> |
42 <div id="r5"> | 45 <div id="r5"> |
43 <div></div> | 46 <div></div> |
44 <div></div> | 47 <div></div> |
45 </div> | 48 </div> |
46 </div> | 49 </div> |
47 <div> | 50 <div> |
48 <div id="t6"></div> | 51 <div id="t6"></div> |
49 <div></div> | 52 <div></div> |
50 <div id="r6" class="sibling"> | 53 <div id="r6" class="sibling"> |
51 <div></div> | 54 <div></div> |
52 <div></div> | 55 <div></div> |
53 </div> | 56 </div> |
| 57 <div></div> |
| 58 </div> |
| 59 <div> |
| 60 <div id="t7"></div> |
| 61 <div> |
| 62 <div class="child"></div> |
| 63 </div> |
| 64 <div> |
| 65 <div id="r7" class="child"></div> |
| 66 </div> |
| 67 <div> |
| 68 <div class="child"></div> |
| 69 </div> |
| 70 </div> |
| 71 <div> |
| 72 <div id="t8"></div> |
| 73 <div class="sibling"> |
| 74 <div id="r8"></div> |
| 75 </div> |
54 </div> | 76 </div> |
55 <script> | 77 <script> |
56 document.body.offsetTop; | 78 document.body.offsetTop; |
57 | 79 |
58 test(function() { | 80 test(function() { |
59 assert_true(!!window.internals, "This test only works with internals exposed
present"); | 81 assert_true(!!window.internals, "This test only works with internals exposed
present"); |
60 assert_equals(getComputedStyle(r1).backgroundColor, "rgba(0, 0, 0, 0)", "Bac
kground color should initially be transparent"); | 82 assert_equals(getComputedStyle(r1).backgroundColor, "rgba(0, 0, 0, 0)", "Bac
kground color should initially be transparent"); |
61 | 83 |
62 t1.className = "t1"; | 84 t1.className = "t1"; |
63 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 3, "Subt
ree style recalc"); | 85 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 3, "Subt
ree style recalc"); |
(...skipping 19 matching lines...) Expand all Loading... |
83 t3.className = "t3"; | 105 t3.className = "t3"; |
84 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 3, "Subt
ree style recalc"); | 106 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 3, "Subt
ree style recalc"); |
85 assert_equals(getComputedStyle(r3).backgroundColor, "rgb(0, 128, 0)", "Backg
round color is green after class change"); | 107 assert_equals(getComputedStyle(r3).backgroundColor, "rgb(0, 128, 0)", "Backg
round color is green after class change"); |
86 }, "Adjacent with universal :hover selector"); | 108 }, "Adjacent with universal :hover selector"); |
87 | 109 |
88 test(function() { | 110 test(function() { |
89 assert_true(!!window.internals, "This test only works with internals exposed
present"); | 111 assert_true(!!window.internals, "This test only works with internals exposed
present"); |
90 assert_equals(getComputedStyle(r4).backgroundColor, "rgba(0, 0, 0, 0)", "Bac
kground color should initially be transparent"); | 112 assert_equals(getComputedStyle(r4).backgroundColor, "rgba(0, 0, 0, 0)", "Bac
kground color should initially be transparent"); |
91 | 113 |
92 t4.className = "t4"; | 114 t4.className = "t4"; |
93 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 4, "Subt
ree style recalc"); | 115 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 1, "Subt
ree style recalc"); |
94 assert_equals(getComputedStyle(r4).backgroundColor, "rgb(0, 128, 0)", "Backg
round color is green after class change"); | 116 assert_equals(getComputedStyle(r4).backgroundColor, "rgb(0, 128, 0)", "Backg
round color is green after class change"); |
95 }, "Class change affecting selector for sibling class"); | 117 }, "Class change affecting selector for sibling class"); |
96 | 118 |
97 test(function() { | 119 test(function() { |
98 assert_true(!!window.internals, "This test only works with internals exposed
present"); | 120 assert_true(!!window.internals, "This test only works with internals exposed
present"); |
99 assert_equals(getComputedStyle(r5).backgroundColor, "rgba(0, 0, 0, 0)", "Bac
kground color should initially be transparent"); | 121 assert_equals(getComputedStyle(r5).backgroundColor, "rgba(0, 0, 0, 0)", "Bac
kground color should initially be transparent"); |
100 | 122 |
101 t5.className = "t5"; | 123 t5.className = "t5"; |
102 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 4, "Subt
ree style recalc"); | 124 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 3, "Subt
ree style recalc"); |
103 assert_equals(getComputedStyle(r5).backgroundColor, "rgb(0, 128, 0)", "Backg
round color is green after class change"); | 125 assert_equals(getComputedStyle(r5).backgroundColor, "rgb(0, 128, 0)", "Backg
round color is green after class change"); |
104 }, "Class change affecting all sibling subtrees through a universal selector"); | 126 }, "Class change affecting all sibling subtrees through a universal selector"); |
105 | 127 |
106 test(function() { | 128 test(function() { |
107 assert_true(!!window.internals, "This test only works with internals exposed
present"); | 129 assert_true(!!window.internals, "This test only works with internals exposed
present"); |
108 assert_equals(getComputedStyle(r6).backgroundColor, "rgba(0, 0, 0, 0)", "Bac
kground color should initially be transparent"); | 130 assert_equals(getComputedStyle(r6).backgroundColor, "rgba(0, 0, 0, 0)", "Bac
kground color should initially be transparent"); |
109 | 131 |
110 t6.className = "t6"; | 132 t6.className = "t6"; |
111 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 5, "Subt
ree style recalc"); | 133 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 1, "Subt
ree style recalc"); |
112 assert_equals(getComputedStyle(r6).backgroundColor, "rgb(0, 128, 0)", "Backg
round color is green after class change"); | 134 assert_equals(getComputedStyle(r6).backgroundColor, "rgb(0, 128, 0)", "Backg
round color is green after class change"); |
113 }, "Class change affecting all sibling subtrees through an indirect adjacent com
binator"); | 135 }, "Class change affecting all sibling subtrees through an indirect adjacent com
binator"); |
| 136 |
| 137 test(function() { |
| 138 assert_true(!!window.internals, "This test only works with internals exposed
present"); |
| 139 assert_equals(getComputedStyle(r7).backgroundColor, "rgba(0, 0, 0, 0)", "Bac
kground color should initially be transparent"); |
| 140 |
| 141 t7.className = "t7"; |
| 142 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 6, "Subt
ree style recalc"); |
| 143 assert_equals(getComputedStyle(r7).backgroundColor, "rgb(0, 128, 0)", "Backg
round color is green after class change"); |
| 144 }, "Class change affecting sibling descendants through a universal selector"); |
| 145 |
| 146 test(function() { |
| 147 assert_true(!!window.internals, "This test only works with internals exposed
present"); |
| 148 assert_equals(getComputedStyle(r8).backgroundColor, "rgba(0, 0, 0, 0)", "Bac
kground color should initially be transparent"); |
| 149 |
| 150 t8.className = "t8"; |
| 151 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 2, "Subt
ree style recalc"); |
| 152 assert_equals(getComputedStyle(r8).backgroundColor, "rgb(0, 128, 0)", "Backg
round color is green after class change"); |
| 153 }, "Class change affecting universal descendants of webkit-any sibling"); |
| 154 |
114 </script> | 155 </script> |
OLD | NEW |