tor-browser

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

deep-nested-inline-size-containers.html (1311B)


      1 <!doctype html>
      2 <title>CSS Container Queries Test: Deeply nested inline-size container queries</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 id="test_style">
      8  .container { container-type: inline-size; }
      9  #outer { width: 200px; }
     10 </style>
     11 <div id="outer" class="container"></div>
     12 <script>
     13  setup(() => {
     14    assert_implements_size_container_queries();
     15 
     16    // Create 50 nested inline-size containers where a child container is 1px
     17    // narrower than its parent
     18    let sheet = test_style.sheet;
     19    let container = outer;
     20    for (let width = 200; width > 150; --width) {
     21      sheet.insertRule(`
     22        @container (width = ${width}px) {
     23          .container { max-width: ${width-1}px; }
     24        }
     25      `);
     26      let child = document.createElement("div");
     27      child.className = "container";
     28      container.appendChild(child);
     29      container = child;
     30    }
     31  });
     32 
     33  test(() => {
     34    let expected_width = 200;
     35    for (let container of document.querySelectorAll(".container"))
     36      assert_equals(container.offsetWidth, expected_width--);
     37  }, "Test that all container widths match");
     38 </script>