2 <script src=
"../../../resources/testharness.js"></script>
3 <script src=
"../../../resources/testharnessreport.js"></script>
12 .t8 + :-webkit-any(.sibling) * { background-color: rgb(
0,
128,
0); }
14 #r3 { width:
10px; height:
10px }
18 <div class=
"sibling"></div>
24 <div class=
"sibling"></div>
31 <div class=
"sibling"></div>
37 <div id=
"r4" class=
"sibling">
41 <div class=
"sibling"></div>
54 <div id=
"r6" class=
"sibling">
62 <div class=
"child"></div>
65 <div class=
"child"></div>
69 <div id=
"r7" class=
"child"></div>
73 <div class=
"child"></div>
83 document
.body
.offsetTop
;
86 assert_true(!!window
.internals
, "This test only works with internals exposed present");
87 }, "internals are exposed");
90 assert_equals(getComputedStyle(r1
).backgroundColor
, "rgba(0, 0, 0, 0)", "Background color should initially be transparent");
93 assert_equals(internals
.updateStyleAndReturnAffectedElementCount(), 3, "Subtree style recalc");
94 assert_equals(getComputedStyle(r1
).backgroundColor
, "rgb(0, 128, 0)", "Background color is green after class change");
95 }, "Adjacent with universal selector");
98 assert_equals(getComputedStyle(r2
).backgroundColor
, "rgba(0, 0, 0, 0)", "Background color should initially be transparent");
101 assert_equals(internals
.updateStyleAndReturnAffectedElementCount(), 4, "Subtree style recalc");
102 assert_equals(getComputedStyle(r2
).backgroundColor
, "rgb(0, 128, 0)", "Background color is green after class change");
103 }, "Indirect adjacent with universal selector");
106 assert_true(!!window
.eventSender
, "This test only works with eventSender present");
108 eventSender
.mouseMoveTo(r3
.offsetLeft
+ 1, r3
.offsetTop
+ 1);
109 assert_equals(getComputedStyle(r3
).backgroundColor
, "rgba(0, 0, 0, 0)", "Background color should initially be transparent");
112 assert_equals(internals
.updateStyleAndReturnAffectedElementCount(), 3, "Subtree style recalc");
113 assert_equals(getComputedStyle(r3
).backgroundColor
, "rgb(0, 128, 0)", "Background color is green after class change");
114 }, "Adjacent with universal :hover selector");
117 assert_equals(getComputedStyle(r4
).backgroundColor
, "rgba(0, 0, 0, 0)", "Background color should initially be transparent");
120 assert_equals(internals
.updateStyleAndReturnAffectedElementCount(), 5, "Subtree style recalc");
121 assert_equals(getComputedStyle(r4
).backgroundColor
, "rgb(0, 128, 0)", "Background color is green after class change");
122 }, "Class change affecting selector for sibling class");
125 assert_equals(getComputedStyle(r5
).backgroundColor
, "rgba(0, 0, 0, 0)", "Background color should initially be transparent");
128 assert_equals(internals
.updateStyleAndReturnAffectedElementCount(), 5, "Subtree style recalc");
129 assert_equals(getComputedStyle(r5
).backgroundColor
, "rgb(0, 128, 0)", "Background color is green after class change");
130 }, "Class change affecting all sibling subtrees through a universal selector");
133 assert_equals(getComputedStyle(r6
).backgroundColor
, "rgba(0, 0, 0, 0)", "Background color should initially be transparent");
136 assert_equals(internals
.updateStyleAndReturnAffectedElementCount(), 6, "Subtree style recalc");
137 assert_equals(getComputedStyle(r6
).backgroundColor
, "rgb(0, 128, 0)", "Background color is green after class change");
138 }, "Class change affecting all sibling subtrees through an indirect adjacent combinator");
141 assert_equals(getComputedStyle(r7
).backgroundColor
, "rgba(0, 0, 0, 0)", "Background color should initially be transparent");
144 assert_equals(internals
.updateStyleAndReturnAffectedElementCount(), 8, "Subtree style recalc");
145 assert_equals(getComputedStyle(r7
).backgroundColor
, "rgb(0, 128, 0)", "Background color is green after class change");
146 }, "Class change affecting sibling descendants through a universal selector");
149 assert_equals(getComputedStyle(r8
).backgroundColor
, "rgba(0, 0, 0, 0)", "Background color should initially be transparent");
152 assert_equals(internals
.updateStyleAndReturnAffectedElementCount(), 3, "Subtree style recalc");
153 assert_equals(getComputedStyle(r8
).backgroundColor
, "rgb(0, 128, 0)", "Background color is green after class change");
154 }, "Class change affecting universal descendants of webkit-any sibling");