supports-conditionText.html (1299B)
1 <!DOCTYPE HTML> 2 <meta charset=UTF-8> 3 <title>CSSGroupingRule Conditional Rules Test</title> 4 <link rel="author" title="L. David Baron" href="https://dbaron.org/"> 5 <link rel="help" href="https://www.w3.org/TR/css-conditional-3/#the-cssconditionrule-interface"> 6 <script src="/resources/testharness.js"></script> 7 <script src="/resources/testharnessreport.js"></script> 8 9 <style id="style"></style> 10 11 <script> 12 13 function check_condition_text(text) { 14 test(function() { 15 let style_element = document.getElementById("style"); 16 style_element.textContent = `@supports ${text} {}`; 17 let rules = style_element.sheet.cssRules; 18 assert_equals(rules.length, 1); 19 assert_equals(rules[0].conditionText, text); 20 }, `conditionText getter for @supports ${text}`); 21 } 22 23 check_condition_text("(color: red)"); 24 check_condition_text("(color : red) or ( color:blue )"); 25 check_condition_text("not (color: red)"); 26 check_condition_text("()"); 27 check_condition_text("func()"); 28 check_condition_text("([])"); 29 check_condition_text("({})"); 30 check_condition_text("(())"); 31 check_condition_text("(func())"); 32 check_condition_text("(x)"); 33 check_condition_text("func(x)"); 34 check_condition_text("([x])"); 35 check_condition_text("({x})"); 36 check_condition_text("((x))"); 37 check_condition_text("(func(x))"); 38 39 </script> 40 </body> 41 </html>