-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Expand file tree
/
Copy pathsupports-at-rule.html
More file actions
53 lines (45 loc) · 2.14 KB
/
supports-at-rule.html
File metadata and controls
53 lines (45 loc) · 2.14 KB
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
<!doctype html>
<title>@supports at-rule</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>
function test_supports(rule, expected, desc) {
test(() => {
assert_equals(CSS.supports(rule), expected, 'CSS.supports(' + rule + ')');
}, desc);
}
// Basic at-rule support.
test_supports("at-rule(@supports)", true);
test_supports("at-rule( @supports)", true);
test_supports("at-rule(@supports )", true);
test_supports("at-rule(@media)", true);
test_supports("at-rule(@counter-style)", true);
test_supports("at-rule(@doesnotexist)", false);
// At-rules with special positioning requirements.
test_supports("at-rule(@import)", true);
test_supports("at-rule(@swash)", true);
test_supports("at-rule(@starting-style)", true);
// @charset is not an at-rule.
test_supports("at-rule(@charset)", false);
// Descriptors are not accepted.
test_supports("at-rule(@counter-style; system: fixed)", false);
// Combining at-rule() with <supports-decl> using 'and'.
test_supports("at-rule(@supports) and (color: red)", true);
test_supports("at-rule(@media) and (display: flex)", true);
test_supports("at-rule(@doesnotexist) and (color: red)", false);
test_supports("at-rule(@supports) and (doesnotexist: red)", false);
// Combining at-rule() with <supports-decl> using 'or'.
test_supports("at-rule(@supports) or (color: red)", true);
test_supports("at-rule(@doesnotexist) or (color: red)", true);
test_supports("at-rule(@supports) or (doesnotexist: red)", true);
test_supports("at-rule(@doesnotexist) or (doesnotexist: red)", false);
// 'not' with at-rule().
test_supports("not at-rule(@supports)", false);
test_supports("not at-rule(@doesnotexist)", true);
// <supports-decl> first, at-rule() second.
test_supports("(color: red) and at-rule(@supports)", true);
test_supports("(color: red) and at-rule(@doesnotexist)", false);
test_supports("(color: red) or at-rule(@doesnotexist)", true);
test_supports("(doesnotexist: red) or at-rule(@doesnotexist)", false);
</script>