tor-browser

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

backdrop-invalidation.html (1301B)


      1 <!doctype html>
      2 <title>Test that ::backdrop responds 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  :root {
      9    color: black;
     10  }
     11 
     12  #container {
     13    container-type: size;
     14    width: 200px;
     15    height: 40px;
     16  }
     17 
     18  ::backdrop {
     19    background-color: black;
     20  }
     21 
     22  @container (min-width: 300px) {
     23    ::backdrop {
     24      background-color: green;
     25    }
     26  }
     27 </style>
     28 <main id=container>
     29  <dialog>test</dialog>
     30 </main>
     31 <script>
     32  setup(() => assert_implements_size_container_queries());
     33 
     34  let dialog = document.querySelector('dialog');
     35 
     36  test(function() {
     37    try {
     38      dialog.showModal();
     39 
     40      assert_equals(getComputedStyle(dialog, '::backdrop').backgroundColor, 'rgb(0, 0, 0)');
     41 
     42      container.style.width = '300px';
     43      assert_equals(getComputedStyle(dialog, '::backdrop').backgroundColor, 'rgb(0, 128, 0)');
     44 
     45      container.style = '';
     46      assert_equals(getComputedStyle(dialog, '::backdrop').backgroundColor, 'rgb(0, 0, 0)');
     47    } finally {
     48      dialog.close();
     49    }
     50  }, 'Pseudo-element ::backdrop responds to container size changes');
     51 </script>