summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/selectors/child-indexed-no-parent.html
blob: c77564bf554c0c9ebaa00b784afb7787abb2db62 (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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<!doctype html>
<meta charset="utf-8">
<title>CSS Test: child-indexed selectors should match without a parent element.</title>
<link rel="author" title="Emilio Cobos Álvarez" href="mailto:ecoal95@gmail.com">
<link rel="help" href="https://drafts.csswg.org/selectors-4/#child-index">
<link rel="match" href="child-indexed-no-parent-ref.html">
<style>
  :root:first-child #a {
    color: green;
  }
  :root:nth-child(n) #b {
    color: green;
  }
  :root:first-of-type #c {
    color: green;
  }
  :root:nth-of-type(1) #d {
    color: green;
  }
  :root:last-of-type #e {
    color: green;
  }
  :root:last-child #f {
    color: green;
  }
  :root:nth-last-child(1) #g {
    color: green;
  }
  :root:nth-last-of-type(n) #h {
    color: green;
  }

  #i {
    color: green;
  }

  /* NB: not matching intentionally */
  :root:nth-last-child(2) #i {
    color: red;
  }
</style>
<p id="a">Should be green
<p id="b">Should be green
<p id="c">Should be green
<p id="d">Should be green
<p id="e">Should be green
<p id="f">Should be green
<p id="g">Should be green
<p id="h">Should be green
<p id="i">Should be green