has-invalidation-after-removing-non-first-element.html (942B)
1 <!DOCTYPE html> 2 <meta charset="utf-8"> 3 <title>:has() invalidation after removing non-first element</title> 4 <link rel="author" title="Byungwoo Lee" href="mailto:blee@igalia.com"> 5 <script src="/resources/testharness.js"></script> 6 <script src="/resources/testharnessreport.js"></script> 7 <link rel="help" href="https://drafts.csswg.org/selectors/#relational"> 8 <style> 9 div, main { color: grey } 10 #subject:has(descendant) { color: red } 11 </style> 12 <main id="main"> 13 <div id="subject"> 14 <div></div> 15 <descendant id="descendant"></descendant> 16 </div> 17 </main> 18 <script> 19 let grey = 'rgb(128, 128, 128)'; 20 let red = 'rgb(255, 0, 0)'; 21 22 function test_div(test_name, el, color) { 23 test(function() { 24 assert_equals(getComputedStyle(el).color, color); 25 }, test_name + ': div#' + el.id + '.color'); 26 } 27 28 test_div('initial_color', subject, red); 29 subject.removeChild(descendant); 30 test_div('remove descendant', subject, grey); 31 </script>