tor-browser

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

env-in-custom-properties.tentative.html (989B)


      1 <!DOCTYPE html>
      2 <html>
      3  <head>
      4    <link rel="help" href="https://drafts.csswg.org/css-env-1/">
      5    <title>Test env() will work in custom properties</title>
      6    <script src="/resources/testharness.js"></script>
      7    <script src="/resources/testharnessreport.js"></script>
      8    <style>
      9      #parent {
     10        --var1: inherited;
     11      }
     12      #child {
     13        --my-width: env(test, 100px);
     14        width: var(--my-width);
     15        --var1: env(nonexistent);
     16      }
     17    </style>
     18  </head>
     19  <body>
     20    <div id="parent">
     21      <div id="child"></div>
     22    </div>
     23    <script>
     24    test(() => {
     25      const style = window.getComputedStyle(child);
     26      assert_equals(style.getPropertyValue("width"), "100px");
     27    }, 'env() is substituted into a custom property');
     28 
     29    test(() => {
     30      const style = window.getComputedStyle(child);
     31      assert_equals(style.getPropertyValue("--var1"), "");
     32    }, 'Substitution of unrecognized env() causes guaranteed-invalid');
     33    </script>
     34  </body>
     35 </html>