tor-browser

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

container-size-invalidation.html (1239B)


      1 <!doctype html>
      2 <title>@container-dependent elements respond to container size changes</title>
      3 <link rel="help" href="https://drafts.csswg.org/css-conditional-5/#size-container">
      4 <script src="/resources/testharness.js"></script>
      5 <script src="/resources/testharnessreport.js"></script>
      6 <script src="support/cq-testcommon.js"></script>
      7 <style>
      8  #container {
      9    container-type: size;
     10    width: 200px;
     11    height: 50px;
     12  }
     13  div { color: red; }
     14  @container (min-width: 300px) {
     15    div { color: green; }
     16  }
     17 </style>
     18 <main id=container>
     19  <div id=child>
     20    Test
     21    <p><span id=descendant>Deep</span></p>
     22  </div>
     23 </main>
     24 <script>
     25  setup(() => assert_implements_size_container_queries());
     26 
     27  test(function() {
     28    assert_equals(getComputedStyle(child).color, 'rgb(255, 0, 0)');
     29    container.style.width = '300px';
     30    assert_equals(getComputedStyle(child).color, 'rgb(0, 128, 0)');
     31  }, 'Children respond to changes in container size');
     32 
     33  test(function() {
     34    container.style = '';
     35    assert_equals(getComputedStyle(descendant).color, 'rgb(255, 0, 0)');
     36    container.style.width = '300px';
     37    assert_equals(getComputedStyle(descendant).color, 'rgb(0, 128, 0)');
     38  }, 'Descendants respond to changes in container size');
     39 </script>