Index: third_party/WebKit/LayoutTests/fast/css/invalidation/nth-pseudo.html |
diff --git a/third_party/WebKit/LayoutTests/fast/css/invalidation/nth-pseudo.html b/third_party/WebKit/LayoutTests/fast/css/invalidation/nth-pseudo.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..bcf504a1a783ba89ae960608d7158a09ac0db30c |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/fast/css/invalidation/nth-pseudo.html |
@@ -0,0 +1,43 @@ |
+<!DOCTYPE html> |
+<script src="../../../resources/testharness.js"></script> |
+<script src="../../../resources/testharnessreport.js"></script> |
+<style> |
+ #t1 > :nth-child(even) { |
+ background-color: green |
+ } |
+ #t2 > :nth-last-child(even) { |
+ background-color: green |
+ } |
+</style> |
+<div id="t1"> |
+ <span></span> |
+</div> |
+<div id="t2"> |
+ <span></span> |
+</div> |
+ |
+<script> |
+ function backgroundIsGreen(element) { |
+ assert_equals(getComputedStyle(element).backgroundColor, "rgb(0, 128, 0)"); |
+ } |
+ |
+ function backgroundIsTransparent(element) { |
+ assert_equals(getComputedStyle(element).backgroundColor, "rgba(0, 0, 0, 0)"); |
+ } |
+ |
+ test(() => { |
+ t1.offsetTop; |
+ assert_equals(t1.lastChild.nodeType, Node.TEXT_NODE); |
+ t1.insertBefore(document.createElement("span"), t1.lastChild); |
+ assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 1); |
+ }, "Appending an element sibling should not affect :nth-child of preceeding siblings."); |
+ |
+ test(() => { |
+ t2.offsetTop; |
+ assert_equals(t2.firstChild.nodeType, Node.TEXT_NODE); |
+ assert_equals(t2.firstChild.nextSibling.nodeType, Node.ELEMENT_NODE); |
+ t2.insertBefore(document.createElement("span"), t2.firstChild.nextSibling); |
+ assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 1); |
+ }, "Prepending an element sibling should not affect :nth-last-child of succeeding siblings."); |
+ |
+</script> |