2 <script src=
"../../../resources/testharness.js"></script>
3 <script src=
"../../../resources/testharnessreport.js"></script>
7 #p3 :not(.t3) :not(.nomatch),
8 #p4 .t4 :not(.nomatch),
9 #p5 :-webkit-any(:not(.t5), #dummy) #r5,
10 #p6 .t6 #r6:not(.dummy),
11 #p7 + :not(.t7) + :not(.nomatch) #r7,
12 #p8 + .t8 ~ div :not(.nomatch) { background-color: rgb(
0,
128,
0); }
15 <div id=
"t1" class=
"t1">
21 <div id=
"t2" class=
"t2">
27 <div id=
"t3" class=
"t3">
39 <div id=
"t5" class=
"t5">
52 <div id=
"t7" class=
"t7"></div>
71 document
.body
.offsetTop
;
74 assert_true(!!window
.internals
, "This test only works with internals exposed present");
75 }, "internals are exposed");
78 assert_equals(getComputedStyle(t1
).backgroundColor
, "rgba(0, 0, 0, 0)", "Background color should initially be transparent");
81 assert_equals(internals
.updateStyleAndReturnAffectedElementCount(), 1, "Single element style recalc");
82 assert_equals(getComputedStyle(t1
).backgroundColor
, "rgb(0, 128, 0)", "Background color is green after class change");
83 }, "Negated class without combinators");
86 assert_equals(getComputedStyle(r2
).backgroundColor
, "rgba(0, 0, 0, 0)", "Background color should initially be transparent");
89 assert_equals(internals
.updateStyleAndReturnAffectedElementCount(), 1, "Recalc changed element and #r2");
90 assert_equals(getComputedStyle(r2
).backgroundColor
, "rgb(0, 128, 0)", "Background color is green after class change");
91 }, "Id descendant of negated class");
94 assert_equals(getComputedStyle(r3
).backgroundColor
, "rgba(0, 0, 0, 0)", "Background color should initially be transparent");
97 assert_equals(internals
.updateStyleAndReturnAffectedElementCount(), 3, "Subtree style recalc");
98 assert_equals(getComputedStyle(r3
).backgroundColor
, "rgb(0, 128, 0)", "Background color is green after class change");
99 }, "Negated class descendant of negated class");
102 assert_equals(getComputedStyle(r4
).backgroundColor
, "rgba(0, 0, 0, 0)", "Background color should initially be transparent");
105 assert_equals(internals
.updateStyleAndReturnAffectedElementCount(), 3, "Subtree style recalc");
106 assert_equals(getComputedStyle(r4
).backgroundColor
, "rgb(0, 128, 0)", "Background color is green after class change");
107 }, "Negated class descendant of class");
110 assert_equals(getComputedStyle(r5
).backgroundColor
, "rgba(0, 0, 0, 0)", "Background color should initially be transparent");
113 assert_equals(internals
.updateStyleAndReturnAffectedElementCount(), 1, "Recalc changed element and #r5");
114 assert_equals(getComputedStyle(r5
).backgroundColor
, "rgb(0, 128, 0)", "Background color is green after class change");
115 }, "Id descendant of negated class in :-webkit-any");
118 assert_equals(getComputedStyle(r6
).backgroundColor
, "rgba(0, 0, 0, 0)", "Background color should initially be transparent");
121 assert_equals(internals
.updateStyleAndReturnAffectedElementCount(), 1, "Recalc changed element and #r6");
122 assert_equals(getComputedStyle(r6
).backgroundColor
, "rgb(0, 128, 0)", "Background color is green after class change");
123 }, "Negated class with id descendant of class");
126 assert_equals(getComputedStyle(r7
).backgroundColor
, "rgba(0, 0, 0, 0)", "Background color should initially be transparent");
129 assert_equals(internals
.updateStyleAndReturnAffectedElementCount(), 4, "Recalc changed element and #r7");
130 assert_equals(getComputedStyle(r7
).backgroundColor
, "rgb(0, 128, 0)", "Background color is green after class change");
131 }, "Id descendant of negated sibling class");
134 assert_equals(getComputedStyle(r8
).backgroundColor
, "rgba(0, 0, 0, 0)", "Background color should initially be transparent");
137 assert_equals(internals
.updateStyleAndReturnAffectedElementCount(), 6, "Subtree style recalc");
138 assert_equals(getComputedStyle(r8
).backgroundColor
, "rgb(0, 128, 0)", "Background color is green after class change");
139 }, "Negated class descendant of sibling class");