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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/dom/ContainerNode.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <script src="../../../resources/testharness.js"></script>
3 <script src="../../../resources/testharnessreport.js"></script>
4 <style>
5 div {
6 color: black;
7 }
8 span:first-child {
9 color: blue;
10 }
11 span:last-child {
12 color: red;
13 }
14 </style>
15 <div id="target"><span>first-initially</span><span>last-initially</span></div>
16 <script>
17 test(() => {
18 let target = document.querySelector('#target');
19 let first = target.firstChild;
20 assert_equals(getComputedStyle(first).color, 'rgb(0, 0, 255)');
21 target.insertAdjacentHTML('afterbegin', '\n<span>foo</span><span>bar</span>');
22 assert_equals(getComputedStyle(target.firstElementChild).color, 'rgb(0, 0, 255 )');
23 assert_equals(getComputedStyle(first).color, 'rgb(0, 0, 0)');
24 }, 'Adding multiple nodes at once should invalidate :first-child correctly.');
25
26 test(() => {
27 let target = document.querySelector('#target');
28 let last = target.lastChild;
29 assert_equals(getComputedStyle(last).color, 'rgb(255, 0, 0)');
30 target.insertAdjacentHTML('beforeend', '\n<span>foo</span><span>bar</span>');
31 assert_equals(getComputedStyle(target.lastChild).color, 'rgb(255, 0, 0)');
32 assert_equals(getComputedStyle(last).color, 'rgb(0, 0, 0)');
33 }, 'Adding multiple nodes at once should invalidate :last-child correctly.');
34 </script>
OLDNEW
« 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