Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!DOCTYPE html> | |
| 2 <script src="../../../resources/testharness.js"></script> | |
| 3 <script src="../../../resources/testharnessreport.js"></script> | |
| 4 <style> | |
| 5 .t1 .sibling + *, | |
| 6 .t2 .sibling ~ *, | |
| 7 .t3 .sibling + :hover, | |
| 8 .t4 + .sibling, | |
|
chrishtr
2014/08/06 02:29:43
please add .t6 ~ .sibling also.
rune
2014/08/07 10:06:45
Done.
| |
| 9 .t5 + * { background-color: rgb(0, 128, 0); } | |
| 10 | |
| 11 #r3 { width: 10px; height: 10px } | |
| 12 </style> | |
| 13 <div> | |
| 14 <div id="t1"> | |
| 15 <div class="sibling"></div> | |
| 16 <div id="r1"></div> | |
| 17 </div> | |
| 18 </div> | |
| 19 <div> | |
| 20 <div id="t2"> | |
| 21 <div class="sibling"></div> | |
| 22 <div></div> | |
| 23 <div id="r2"></div> | |
| 24 </div> | |
| 25 </div> | |
| 26 <div> | |
| 27 <div id="t3"> | |
| 28 <div class="sibling"></div> | |
| 29 <div id="r3"></div> | |
| 30 </div> | |
| 31 </div> | |
| 32 <div> | |
| 33 <div id="t4"></div> | |
| 34 <div id="r4" class="sibling"> | |
| 35 <div></div> | |
| 36 <div></div> | |
| 37 </div> | |
| 38 </div> | |
| 39 <div> | |
| 40 <div id="t5"></div> | |
| 41 <div id="r5"> | |
| 42 <div></div> | |
| 43 <div></div> | |
| 44 </div> | |
| 45 </div> | |
| 46 <script> | |
| 47 document.body.offsetTop; | |
| 48 | |
| 49 test(function() { | |
| 50 assert_true(!!window.internals, "This test only works with internals exposed present"); | |
| 51 assert_equals(getComputedStyle(r1).backgroundColor, "rgba(0, 0, 0, 0)", "Bac kground color should initially be transparent"); | |
| 52 | |
| 53 t1.className = "t1"; | |
| 54 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 3, "Subt ree style recalc"); | |
| 55 assert_equals(getComputedStyle(r1).backgroundColor, "rgb(0, 128, 0)", "Backg round color is green after class change"); | |
| 56 }, "Adjacent with universal selector"); | |
| 57 | |
| 58 test(function() { | |
| 59 assert_true(!!window.internals, "This test only works with internals exposed present"); | |
| 60 assert_equals(getComputedStyle(r2).backgroundColor, "rgba(0, 0, 0, 0)", "Bac kground color should initially be transparent"); | |
| 61 | |
| 62 t2.className = "t2"; | |
| 63 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 4, "Subt ree style recalc"); | |
| 64 assert_equals(getComputedStyle(r2).backgroundColor, "rgb(0, 128, 0)", "Backg round color is green after class change"); | |
| 65 }, "Indirect adjacent with universal selector"); | |
| 66 | |
| 67 test(function() { | |
| 68 assert_true(!!window.internals, "This test only works with internals exposed present"); | |
| 69 assert_true(!!window.eventSender, "This test only works with eventSender pre sent"); | |
| 70 | |
| 71 eventSender.mouseMoveTo(r3.offsetLeft + 1, r3.offsetTop + 1); | |
| 72 assert_equals(getComputedStyle(r3).backgroundColor, "rgba(0, 0, 0, 0)", "Bac kground color should initially be transparent"); | |
| 73 | |
| 74 t3.className = "t3"; | |
| 75 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 3, "Subt ree style recalc"); | |
| 76 assert_equals(getComputedStyle(r3).backgroundColor, "rgb(0, 128, 0)", "Backg round color is green after class change"); | |
| 77 }, "Adjacent with universal :hover selector"); | |
| 78 | |
| 79 test(function() { | |
| 80 assert_true(!!window.internals, "This test only works with internals exposed present"); | |
| 81 assert_equals(getComputedStyle(r4).backgroundColor, "rgba(0, 0, 0, 0)", "Bac kground color should initially be transparent"); | |
| 82 | |
| 83 t4.className = "t4"; | |
| 84 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 4, "Subt ree style recalc"); | |
| 85 assert_equals(getComputedStyle(r4).backgroundColor, "rgb(0, 128, 0)", "Backg round color is green after class change"); | |
| 86 }, "Class change affecting selector for sibling class"); | |
| 87 | |
| 88 test(function() { | |
| 89 assert_true(!!window.internals, "This test only works with internals exposed present"); | |
| 90 assert_equals(getComputedStyle(r5).backgroundColor, "rgba(0, 0, 0, 0)", "Bac kground color should initially be transparent"); | |
| 91 | |
| 92 t5.className = "t5"; | |
| 93 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 4, "Subt ree style recalc"); | |
| 94 assert_equals(getComputedStyle(r5).backgroundColor, "rgb(0, 128, 0)", "Backg round color is green after class change"); | |
| 95 }, "Class change affecting all sibling subtrees through a universal selector"); | |
| 96 </script> | |
| OLD | NEW |