OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <script src="../../../resources/testharness.js"></script> |
| 3 <script src="../../../resources/testharnessreport.js"></script> |
| 4 <style> |
| 5 #t1 > :nth-child(even) { |
| 6 background-color: green |
| 7 } |
| 8 #t2 > :nth-last-child(even) { |
| 9 background-color: green |
| 10 } |
| 11 </style> |
| 12 <div id="t1"> |
| 13 <span></span> |
| 14 </div> |
| 15 <div id="t2"> |
| 16 <span></span> |
| 17 </div> |
| 18 |
| 19 <script> |
| 20 function backgroundIsGreen(element) { |
| 21 assert_equals(getComputedStyle(element).backgroundColor, "rgb(0, 128, 0)
"); |
| 22 } |
| 23 |
| 24 function backgroundIsTransparent(element) { |
| 25 assert_equals(getComputedStyle(element).backgroundColor, "rgba(0, 0, 0,
0)"); |
| 26 } |
| 27 |
| 28 test(() => { |
| 29 t1.offsetTop; |
| 30 assert_equals(t1.lastChild.nodeType, Node.TEXT_NODE); |
| 31 t1.insertBefore(document.createElement("span"), t1.lastChild); |
| 32 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 1); |
| 33 }, "Appending an element sibling should not affect :nth-child of preceeding
siblings."); |
| 34 |
| 35 test(() => { |
| 36 t2.offsetTop; |
| 37 assert_equals(t2.firstChild.nodeType, Node.TEXT_NODE); |
| 38 assert_equals(t2.firstChild.nextSibling.nodeType, Node.ELEMENT_NODE); |
| 39 t2.insertBefore(document.createElement("span"), t2.firstChild.nextSiblin
g); |
| 40 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 1); |
| 41 }, "Prepending an element sibling should not affect :nth-last-child of succe
eding siblings."); |
| 42 |
| 43 </script> |
OLD | NEW |