supports-at-rule.html (1102B)
1 <!doctype html> 2 <title>@supports at-rule</title> 3 <link rel="help" href="https://www.w3.org/TR/css-conditional-4/#the-css-namespace"> 4 <script src="/resources/testharness.js"></script> 5 <script src="/resources/testharnessreport.js"></script> 6 <script> 7 function test_supports(rule, expected, desc) { 8 test(() => { 9 assert_equals(CSS.supports(rule), expected, 'CSS.supports(' + rule + ')'); 10 }, desc); 11 } 12 13 // Basic at-rule support. 14 test_supports("at-rule(@supports)", true); 15 test_supports("at-rule( @supports)", true); 16 test_supports("at-rule(@supports )", true); 17 test_supports("at-rule(@media)", true); 18 test_supports("at-rule(@counter-style)", true); 19 test_supports("at-rule(@doesnotexist)", false); 20 21 // At-rules with special positioning requirements. 22 test_supports("at-rule(@import)", true); 23 test_supports("at-rule(@swash)", true); 24 test_supports("at-rule(@starting-style)", true); 25 26 // @charset is not an at-rule. 27 test_supports("at-rule(@charset)", false); 28 29 // Descriptors are not accepted. 30 test_supports("at-rule(@counter-style; system: fixed)", false); 31 </script>