Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(355)

Unified Diff: third_party/WebKit/LayoutTests/fast/css/invalidation/nth-pseudo.html

Issue 2228933002: Use elementAfter/Before, not nodeAfter/Before for nth-invalidation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/dom/ContainerNode.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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>
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/dom/ContainerNode.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698