tor-browser

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

aspect-ratio-feature-evaluation.html (1827B)


      1 <!doctype html>
      2 <title>@container queries with aspect-ratio</title>
      3 <link rel="help" href="https://drafts.csswg.org/css-conditional-5/#aspect-ratio">
      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    width: 100px;
     10    height: 100px;
     11  }
     12  #inline-size { container-type: inline-size; }
     13  #size { container-type: size; }
     14  span { color: red }
     15  @container (min-aspect-ratio: 1 / 1000) {
     16    span { color: green; }
     17  }
     18  @container (min-aspect-ratio: 2 / 1) {
     19    span { background-color: lime; }
     20  }
     21 </style>
     22 <div id="inline-size" class="container"><span></span></div>
     23 <div id="size" class="container"><span></span></div>
     24 <script>
     25  setup(() => assert_implements_size_container_queries());
     26 
     27  const red = "rgb(255, 0, 0)";
     28  const green = "rgb(0, 128, 0)";
     29  const lime = "rgb(0, 255, 0)";
     30  const transparent = "rgba(0, 0, 0, 0)";
     31 
     32  const inline_span = document.querySelector("#inline-size > span");
     33  const size_span = document.querySelector("#size > span");
     34 
     35  test(() => {
     36    assert_equals(getComputedStyle(inline_span).color, red,
     37                  "Should not match for inline-size containment");
     38    assert_equals(getComputedStyle(size_span).color, green,
     39                  "Should match for block-size containment");
     40    assert_equals(getComputedStyle(size_span).backgroundColor, transparent,
     41                  "Square should not match 2/1 min-ratio");
     42  }, "@container queries with aspect-ratio and size containment");
     43 
     44  test(() => {
     45    document.querySelector("#size").style.width = "200px";
     46    assert_equals(getComputedStyle(size_span).backgroundColor, lime,
     47                  "Should match 2/1 min-ratio");
     48  }, "@container query with aspect-ratio change after resize");
     49 </script>