summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-conditional/js/CSS-supports-L4.html
blob: 2250e2be749465f57482ffe21167fe626e493391 (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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<!doctype html>
<meta charset="utf-8">
<title>CSS.supports() Level 4</title>
<link rel="help" href="https://www.w3.org/TR/css-conditional-4/#the-css-namespace">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
  test(function() {
    assert_equals(CSS.supports("selector(div)"), true);
  }, "selector() function accepts a selector");

  test(function() {
    assert_equals(CSS.supports("selector(div, div)"), false);
  }, "selector() function doesn't accept a selector list");

  test(function() {
    assert_equals(CSS.supports("selector(::-webkit-unknown-pseudo-element)"), false);
  }, "selector() function rejects unknown webkit pseudo-elements.");

  test(function() {
    assert_equals(CSS.supports("selector(::before)"), true);
  }, "selector() function accepts known pseudo-elements");

  test(function() {
    assert_equals(CSS.supports("selector(div + .c)"), true);
  }, "selector() with simple combinators");

  test(function() {
    assert_equals(CSS.supports("selector(div | .c)"), false);
  }, "selector() with unknown combinators");

  test(function() {
    assert_equals(CSS.supports("selector(:is(:foo))"), false);
  }, "selector() with forgiving :is, 1 arg");

  test(function() {
    assert_equals(CSS.supports("selector(:is(:foo, div))"), false);
  }, "selector() with forgiving :is, multiple args");

  test(function() {
    assert_equals(CSS.supports("selector(:where(:foo))"), false);
  }, "selector() with forgiving :where, 1 arg");

  test(function() {
    assert_equals(CSS.supports("selector(:where(:foo, div))"), false);
  }, "selector() with forgiving :where, multiple args");

  test(function() {
    assert_equals(CSS.supports("selector(:has(:foo))"), false);
  }, "selector() with forgiving :has, 1 arg");

  test(function() {
    assert_equals(CSS.supports("selector(:has(:foo, div))"), false);
  }, "selector() with forgiving :has, multiple args");

  test(function() {
      assert_equals(CSS.supports("selector(:nth-child(2n + 3 of :foo))"), false);
  }, "selector() with unforgiving :nth-child, 1 arg");

  test(function() {
      assert_equals(CSS.supports("selector(:nth-last-child(2n + 3 of :foo))"), false);
  }, "selector() with unforgiving :nth-last-child, 1 arg");

  test(function() {
      assert_equals(CSS.supports("selector(:nth-child(2n + 3 of :foo, div))"), false);
  }, "selector() with unforgiving :nth-child, multiple args");

  test(function() {
      assert_equals(CSS.supports("selector(:nth-last-child(2n + 3 of :foo, div))"), false);
  }, "selector() with unforgiving :nth-last-child, multiple args");

  test(function() {
      assert_equals(CSS.supports("selector(:nth-child(2n 4))"), false);
  }, "selector() with a non-identifier after :nth-child's An+B index");

  test(function() {
      assert_equals(CSS.supports("selector(:nth-last-child(2n 4))"), false);
  }, "selector() with a non-identifier after :nth-last-child's An+B index");
</script>