tor-browser

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

scope-supports.html (1120B)


      1 <!DOCTYPE html>
      2 <title>@scope - inner @supports</title>
      3 <link rel="help" href="https://drafts.csswg.org/css-cascade-6/#scope-atrule">
      4 <link rel="help" href="https://drafts.csswg.org/css-conditional-3/#at-supports">
      5 <link rel="help" href="https://drafts.csswg.org/css-cascade-5/#scope-scope">
      6 <script src="/resources/testharness.js"></script>
      7 <script src="/resources/testharnessreport.js"></script>
      8 <style>
      9  @scope (.a) {
     10    @supports (width:0px) {
     11      :scope {
     12        z-index: 1;
     13      }
     14 
     15      .b {
     16        background-color: green;
     17      }
     18    }
     19  }
     20 </style>
     21 <main>
     22  <div class=a>
     23    <div class=b>
     24    </div>
     25  </div>
     26  <div class=b></div>
     27 </main>
     28 <script>
     29  test(() => {
     30    let a = document.querySelector('main > .a');
     31    let b = document.querySelector('main > .a > .b');
     32    assert_equals(getComputedStyle(a).zIndex, '1');
     33    assert_equals(getComputedStyle(b).backgroundColor, 'rgb(0, 128, 0)');
     34 
     35    let out_of_scope_b = document.querySelector('main > .b');
     36    assert_equals(getComputedStyle(out_of_scope_b).backgroundColor, 'rgba(0, 0, 0, 0)');
     37  }, 'Style rules within @supports are scoped');
     38 </script>