blob: 9e6a5b129a37576f310266525c35c2cf7af0bcea (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
<!doctype html>
<title>CSS Selectors Invalidation: :nth-child(An+B) within shadow root</title>
<link rel="help" href="https://drafts.csswg.org/selectors-3/#nth-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-child-in-shadow-root-ref.html">
<script src="/resources/declarative-shadow-dom-polyfill.js"></script>
<div id="host">
<template shadowrootmode="open">
<div id="firstChild">Should be red</div>
<style>
:nth-child(odd) {
color: green;
}
:nth-child(even) {
color: red;
}
</style>
</template>
</div>
<script>
polyfill_declarative_shadow_dom(host);
host.offsetTop;
let div = document.createElement("div");
div.appendChild(document.createTextNode("Should be green"));
requestAnimationFrame(() =>
requestAnimationFrame(() => {
host.shadowRoot.insertBefore(div, host.shadowRoot.firstElementChild);
takeScreenshot();
}));
</script>
|