nth-last-child-in-shadow-root.html (1023B)
1 <!doctype html> 2 <title>CSS Selectors Invalidation: :nth-last-child(An+B) within shadow root</title> 3 <link rel="help" href="https://drafts.csswg.org/selectors-3/#nth-last-child-pseudo"> 4 <link rel=help href="https://bugzilla.mozilla.org/show_bug.cgi?id=1480746"> 5 <link rel="author" title="Zach Hoffman" href="mailto:zach@zrhoffman.net"> 6 <link rel="match" href="nth-last-child-in-shadow-root-ref.html"> 7 <div id="host"> 8 <template shadowrootmode="open"> 9 <div id="firstChild">Should be red</div> 10 <style> 11 :nth-last-child(odd) { 12 color: red; 13 } 14 :nth-last-child(even) { 15 color: green; 16 } 17 </style> 18 </template> 19 </div> 20 <script> 21 host.offsetTop; 22 let div = document.createElement("div"); 23 div.appendChild(document.createTextNode("Should be green")); 24 requestAnimationFrame(() => 25 requestAnimationFrame(() => { 26 host.shadowRoot.insertBefore(div, host.shadowRoot.firstElementChild.nextSibling); 27 takeScreenshot(); 28 })); 29 </script>