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

Unified Diff: third_party/WebKit/LayoutTests/fast/css/invalidation/firstchild-lastchild-for-multiple-node-insertion.html

Issue 2774753003: Merge "CSS Selector: Fix a regression of :first-child and :last-child invalidation" to M58. (Closed)
Patch Set: Created 3 years, 9 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.h » ('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/firstchild-lastchild-for-multiple-node-insertion.html
diff --git a/third_party/WebKit/LayoutTests/fast/css/invalidation/firstchild-lastchild-for-multiple-node-insertion.html b/third_party/WebKit/LayoutTests/fast/css/invalidation/firstchild-lastchild-for-multiple-node-insertion.html
new file mode 100644
index 0000000000000000000000000000000000000000..6a5a1aa7627d8d45f62f9681fbd516025dd6c8e8
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/css/invalidation/firstchild-lastchild-for-multiple-node-insertion.html
@@ -0,0 +1,34 @@
+<!DOCTYPE html>
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<style>
+div {
+ color: black;
+}
+span:first-child {
+ color: blue;
+}
+span:last-child {
+ color: red;
+}
+</style>
+<div id="target"><span>first-initially</span><span>last-initially</span></div>
+<script>
+test(() => {
+ let target = document.querySelector('#target');
+ let first = target.firstChild;
+ assert_equals(getComputedStyle(first).color, 'rgb(0, 0, 255)');
+ target.insertAdjacentHTML('afterbegin', '\n<span>foo</span><span>bar</span>');
+ assert_equals(getComputedStyle(target.firstElementChild).color, 'rgb(0, 0, 255)');
+ assert_equals(getComputedStyle(first).color, 'rgb(0, 0, 0)');
+}, 'Adding multiple nodes at once should invalidate :first-child correctly.');
+
+test(() => {
+ let target = document.querySelector('#target');
+ let last = target.lastChild;
+ assert_equals(getComputedStyle(last).color, 'rgb(255, 0, 0)');
+ target.insertAdjacentHTML('beforeend', '\n<span>foo</span><span>bar</span>');
+ assert_equals(getComputedStyle(target.lastChild).color, 'rgb(255, 0, 0)');
+ assert_equals(getComputedStyle(last).color, 'rgb(0, 0, 0)');
+}, 'Adding multiple nodes at once should invalidate :last-child correctly.');
+</script>
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/dom/ContainerNode.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698