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