summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/selectors/invalidation/nth-child-of-in-shadow-root.html
blob: 519885ea78537ac906016496c2289d74f6ac86df (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<!DOCTYPE html>
<title>CSS Selectors Invalidation: :nth-child(... of class) within shadow root</title>
<link rel="author" title="Steinar H. Gunderson" href="sesse@chromium.org">
<link rel="match" href="nth-child-of-in-shadow-root-ref.html">
<link rel="help" href="https://drafts.csswg.org/selectors-4/#child-index">
<div id="host">
  <template shadowrootmode="open">
    <style>
      div:nth-child(even of .foo) {
        color: green;
      }
    </style>
    <div class="foo" id="toggler">No green</div>
    <div class="foo">No green</div>
    <div class="foo">Should be green</div>
  </template>
</div>
<script>
  host.offsetTop;
  host.shadowRoot.getElementById('toggler').classList.toggle('foo');
</script>