nth-child-containing-ancestor.html (608B)
1 <!DOCTYPE html> 2 <meta charset="utf-8" /> 3 <title>CSS Selectors Invalidation: :nth-child(... of S) with ancestor in S</title> 4 <link rel="author" title="Steinar H. Gunderson" href="sesse@chromium.org"> 5 <link rel="match" href="nth-child-containing-ancestor-ref.html"> 6 <link rel="help" href="https://drafts.csswg.org/selectors-4/#child-index"> 7 <style> 8 div:nth-child(odd of .a .b) { 9 color: green; 10 } 11 </style> 12 <div id="toggler"> 13 <div> 14 <div> 15 <div class="b">Should be green</div> 16 </div> 17 </div> 18 </div> 19 <script> 20 document.documentElement.offsetTop; 21 toggler.classList.toggle("a"); 22 </script>