wpt / css / selectors / invalidation / nth-last-child-in-shadow-root.html

Status: FAIL | Duration: 9ms | Subtests: 0/1 | Open test on wpt.live | Open ref on wpt.live | wpt.fyi

/css/selectors/invalidation/nth-last-child-in-shadow-root.html

<!doctype html>
<title>CSS Selectors Invalidation: :nth-last-child(An+B) within shadow root</title>
<link rel="help" href="https://drafts.csswg.org/selectors-3/#nth-last-child-pseudo">
<link rel=help href="https://bugzilla.mozilla.org/show_bug.cgi?id=1480746">
<link rel="author" title="Zach Hoffman" href="mailto:zach@zrhoffman.net">
<link rel="match" href="nth-last-child-in-shadow-root-ref.html">
<div id="host">
    <template shadowrootmode="open">
        <div id="firstChild">Should be red</div>
        <style>
        :nth-last-child(odd) {
            color: red;
        }
        :nth-last-child(even) {
            color: green;
        }
        </style>
    </template>
</div>
<script>
host.offsetTop;
let div = document.createElement("div");
div.appendChild(document.createTextNode("Should be green"));
requestAnimationFrame(() =>
    requestAnimationFrame(() => {
            host.shadowRoot.insertBefore(div, host.shadowRoot.firstElementChild.nextSibling);
            takeScreenshot();
    }));
</script>

/css/selectors/invalidation/nth-last-child-in-shadow-root-ref.html

<!doctype html>
<meta charset=utf-8>
<title>CSS Test Reference</title>
<div>
  <div style="color: red">Should be red</div>
  <div style="color: green">Should be green</div>
</div>