tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

CSS-supports-L3.html (3088B)


      1 <!doctype html>
      2 <meta charset="utf-8">
      3 <title>CSS.supports() Level 3</title>
      4 <link rel="help" href="https://www.w3.org/TR/css-conditional-3/#the-css-namespace">
      5 <script src="/resources/testharness.js"></script>
      6 <script src="/resources/testharnessreport.js"></script>
      7 <script>
      8  test(function() {
      9    assert_equals(CSS.supports("(color: red)"), true);
     10  }, "Single-argument form allows for declarations with enclosing parentheses");
     11 
     12  test(function() {
     13    assert_equals(CSS.supports("color: red"), true);
     14  }, "Single-argument form allows for declarations without enclosing parentheses");
     15 
     16  test(function() {
     17    assert_equals(CSS.supports("(color: red) and (color: blue)"), true);
     18  }, "Complex conditions allowed");
     19 
     20  test(function() {
     21    assert_equals(CSS.supports("not (foobar)"), true);
     22  }, "general_enclosed still parses");
     23 
     24  test(function() {
     25    assert_equals(CSS.supports("color: something-pointless var(--foo)"), true);
     26  }, "Variable references always parse");
     27 
     28  test(function() {
     29    assert_equals(CSS.supports("color: something-pointless(var(--foo))"), true);
     30  }, "Variable references in an unknown function always parse");
     31 
     32  test(function() {
     33    // no one-arg test for this as the with/without enclosing parentheses tests do this
     34    assert_equals(CSS.supports("color", "red"), true);
     35  }, "two argument form succeeds for known property");
     36 
     37  test(function() {
     38    assert_equals(CSS.supports("unknownproperty: blah"), false);
     39  }, "one argument form fails for unknown property");
     40 
     41  test(function() {
     42    assert_equals(CSS.supports("unknownproperty", "blah"), false);
     43  }, "two argument form fails for unknown property");
     44 
     45  test(function() {
     46    // https://github.com/w3c/csswg-drafts/issues/5929
     47    assert_equals(CSS.supports("unicode-range: U+0-7F"), false);
     48  }, "one argument form fails for unknown property (but known descriptor)");
     49 
     50  test(function() {
     51    // https://github.com/w3c/csswg-drafts/issues/5929
     52    assert_equals(CSS.supports("unicode-range", "U+0-7F"), false);
     53  }, "two argument form fails for unknown property (but known descriptor)");
     54 
     55  test(function() {
     56    // https://github.com/w3c/csswg-drafts/issues/5929
     57    assert_equals(CSS.supports("unicode-range: inherit"), false);
     58  }, "one argument form fails for unknown property (but known descriptor, universal value)");
     59 
     60  test(function() {
     61    // https://github.com/w3c/csswg-drafts/issues/5929
     62    assert_equals(CSS.supports("unicode-range", "inherit"), false);
     63  }, "two argument form fails for unknown property (but known descriptor, universal value)");
     64 
     65  test(function() {
     66    assert_equals(CSS.supports("width: blah"), false);
     67  }, "one argument form fails for invalid value");
     68 
     69  test(function() {
     70    assert_equals(CSS.supports("width", "blah"), false);
     71  }, "two argument form fails for invalid value");
     72 
     73  test(function() {
     74    assert_equals(CSS.supports("--foo: blah"), true);
     75  }, "one argument form succeeds for custom property");
     76 
     77  test(function() {
     78    assert_equals(CSS.supports("--foo", "blah"), true);
     79  }, "two argument form succeeds for custom property");
     80 </script>