blob: d403111785723ce4e96d4273c224a8d9d5e7b108 (
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
|
<!doctype html>
<meta charset="utf-8">
<title>CSS Selectors Invalidation: :nth-last-child(... of class) within shadow root</title>
<link rel="author" title="Zach Hoffman" href="mailto:zach@zrhoffman.net">
<link rel="author" title="Steinar H. Gunderson" href="mailto:sesse@chromium.org">
<link rel="match" href="nth-last-child-of-in-shadow-root-ref.html">
<link rel="help" href="https://drafts.csswg.org/selectors-4/#child-index">
<script src="/resources/declarative-shadow-dom-polyfill.js"></script>
<div id="host">
<template shadowrootmode="open">
<style>
div:nth-last-child(even of .foo) {
color: green;
}
</style>
<div class="foo">Should be green</div>
<div class="foo">No green</div>
<div class="foo" id="toggler">No green</div>
</template>
</div>
<script>
polyfill_declarative_shadow_dom(host);
host.offsetTop;
host.shadowRoot.getElementById("toggler").classList.toggle("foo");
</script>
|