negated-nth-child-when-ancestor-changes.html (719B)
1 <!doctype html> 2 <meta charset="utf-8" /> 3 <title>CSS Selectors Invalidation: :not(:nth-child(... of class)) when ancestor changes</title> 4 <link rel="author" title="Zach Hoffman" href="mailto:zach@zrhoffman.net"> 5 <link rel="match" href="negated-nth-child-when-ancestor-changes-ref.html"> 6 <link rel="help" href="https://drafts.csswg.org/selectors-4/#child-index"> 7 <style> 8 .ancestor :not(:nth-child(even of .c)) { 9 color: green; 10 } 11 </style> 12 <div id="toggler"> 13 <p>Negated</p> 14 <p class="c">Not ignored</p> 15 <p class="c">Not ignored</p> 16 <p class="c">Not ignored</p> 17 <p class="c">Not ignored</p> 18 <p>Negated</p> 19 </div> 20 <script> 21 document.documentElement.offsetTop; 22 toggler.classList.toggle("ancestor"); 23 </script>