tor-browser

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

scope-starting-style.html (1167B)


      1 <!DOCTYPE html>
      2 <title>@scope - inner @starting-style</title>
      3 <link rel="help" href="https://drafts.csswg.org/css-cascade-6/#scope-atrule">
      4 <link rel="help" href="https://github.com/w3c/csswg-drafts/pull/8876">
      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    @starting-style {
     11      :scope {
     12        width: 100px;
     13      }
     14 
     15      .b {
     16        width: 100px;
     17      }
     18    }
     19  }
     20 
     21  .a, .b {
     22    transition: width 100s steps(2, start); /* 50% progress */
     23    width: 200px;
     24  }
     25 </style>
     26 <main>
     27  <div class=a>
     28    <div class=b>
     29    </div>
     30  </div>
     31  <div class=b></div>
     32 </main>
     33 <script>
     34  test(() => {
     35    let a = document.querySelector('main > .a');
     36    let b = document.querySelector('main > .a > .b');
     37    assert_equals(getComputedStyle(a).width, '150px');
     38    assert_equals(getComputedStyle(b).width, '150px');
     39 
     40    let out_of_scope_b = document.querySelector('main > .b');
     41    assert_equals(getComputedStyle(out_of_scope_b).width, '200px');
     42  }, 'Style rules within @starting-style are scoped');
     43 </script>