OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <script src="../../../resources/testharness.js"></script> |
| 3 <script src="../../../resources/testharnessreport.js"></script> |
| 4 <style> |
| 5 #p1 :not(.t1), |
| 6 #p2 :not(.t2) #r2, |
| 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) { background-color: rgb(0, 128, 0); } |
| 11 </style> |
| 12 <div id="p1"> |
| 13 <div id="t1" class="t1"> |
| 14 <div></div> |
| 15 <div></div> |
| 16 </div> |
| 17 </div> |
| 18 <div id="p2"> |
| 19 <div id="t2" class="t2"> |
| 20 <div></div> |
| 21 <div id="r2"></div> |
| 22 </div> |
| 23 </div> |
| 24 <div id="p3"> |
| 25 <div id="t3" class="t3"> |
| 26 <div></div> |
| 27 <div id="r3"></div> |
| 28 </div> |
| 29 </div> |
| 30 <div id="p4"> |
| 31 <div id="t4"> |
| 32 <div></div> |
| 33 <div id="r4"></div> |
| 34 </div> |
| 35 </div> |
| 36 <div id="p5"> |
| 37 <div id="t5" class="t5"> |
| 38 <div></div> |
| 39 <div id="r5"></div> |
| 40 </div> |
| 41 </div> |
| 42 <div id="p6"> |
| 43 <div id="t6"> |
| 44 <div></div> |
| 45 <div id="r6"></div> |
| 46 </div> |
| 47 </div> |
| 48 <script> |
| 49 document.body.offsetTop; |
| 50 |
| 51 test(function() { |
| 52 assert_true(!!window.internals, "This test only works with internals exposed
present"); |
| 53 assert_equals(getComputedStyle(t1).backgroundColor, "rgba(0, 0, 0, 0)", "Bac
kground color should initially be transparent"); |
| 54 |
| 55 t1.className = ""; |
| 56 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 1, "Sing
le element style recalc"); |
| 57 assert_equals(getComputedStyle(t1).backgroundColor, "rgb(0, 128, 0)", "Backg
round color is green after class change"); |
| 58 }, "Negated class without combinators"); |
| 59 |
| 60 test(function() { |
| 61 assert_true(!!window.internals, "This test only works with internals exposed
present"); |
| 62 assert_equals(getComputedStyle(r2).backgroundColor, "rgba(0, 0, 0, 0)", "Bac
kground color should initially be transparent"); |
| 63 |
| 64 t2.className = ""; |
| 65 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 2, "Reca
lc changed element and #r2"); |
| 66 assert_equals(getComputedStyle(r2).backgroundColor, "rgb(0, 128, 0)", "Backg
round color is green after class change"); |
| 67 }, "Id descendant of negated class"); |
| 68 |
| 69 test(function() { |
| 70 assert_true(!!window.internals, "This test only works with internals exposed
present"); |
| 71 assert_equals(getComputedStyle(r3).backgroundColor, "rgba(0, 0, 0, 0)", "Bac
kground color should initially be transparent"); |
| 72 |
| 73 t3.className = ""; |
| 74 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 3, "Subt
ree style recalc"); |
| 75 assert_equals(getComputedStyle(r3).backgroundColor, "rgb(0, 128, 0)", "Backg
round color is green after class change"); |
| 76 }, "Negated class descendant of negated class"); |
| 77 |
| 78 test(function() { |
| 79 assert_true(!!window.internals, "This test only works with internals exposed
present"); |
| 80 assert_equals(getComputedStyle(r4).backgroundColor, "rgba(0, 0, 0, 0)", "Bac
kground color should initially be transparent"); |
| 81 |
| 82 t4.className = "t4"; |
| 83 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 3, "Subt
ree style recalc"); |
| 84 assert_equals(getComputedStyle(r4).backgroundColor, "rgb(0, 128, 0)", "Backg
round color is green after class change"); |
| 85 }, "Negated class descendant of class"); |
| 86 |
| 87 test(function() { |
| 88 assert_true(!!window.internals, "This test only works with internals exposed
present"); |
| 89 assert_equals(getComputedStyle(r5).backgroundColor, "rgba(0, 0, 0, 0)", "Bac
kground color should initially be transparent"); |
| 90 |
| 91 t5.className = ""; |
| 92 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 2, "Reca
lc changed element and #r5"); |
| 93 assert_equals(getComputedStyle(r5).backgroundColor, "rgb(0, 128, 0)", "Backg
round color is green after class change"); |
| 94 }, "Id descendant of negated class in :-webkit-any"); |
| 95 |
| 96 test(function() { |
| 97 assert_true(!!window.internals, "This test only works with internals exposed
present"); |
| 98 assert_equals(getComputedStyle(r6).backgroundColor, "rgba(0, 0, 0, 0)", "Bac
kground color should initially be transparent"); |
| 99 |
| 100 t6.className = "t6"; |
| 101 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 2, "Reca
lc changed element and #r6"); |
| 102 assert_equals(getComputedStyle(r6).backgroundColor, "rgb(0, 128, 0)", "Backg
round color is green after class change"); |
| 103 }, "Negated class with id descendant of class"); |
| 104 </script> |
OLD | NEW |