has-with-nth-child-sibling-remove.html (790B)
1 <!doctype html> 2 <meta charset="utf-8"> 3 <link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1964745"> 4 <link rel="author" title="David Shin" href="mailto:dshin@mozilla.com"> 5 <link rel="match" href="../../reference/ref-filled-green-100px-square.xht"> 6 <link rel="help" href="https://drafts.csswg.org/selectors-4/#relational"> 7 <style> 8 .square { 9 width: 100px; 10 height: 100px; 11 background: red; 12 } 13 14 .item:not(:has(~ .item > :nth-child(2))) { 15 background: green; 16 } 17 </style> 18 <p>Test passes if there is a filled green square and <strong>no red</strong>.</p> 19 <div id=container> 20 <div class="item square"> 21 <div></div> 22 <div></div> 23 </div> 24 <div id=td class=item> 25 <div></div> 26 <div></div> 27 </div> 28 </div> 29 <script> 30 window.onload = () => { 31 td.remove(); 32 }; 33 </script>