tor-browser

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

sheet-going-away-001.html (1003B)


      1 <!doctype html>
      2 <meta charset="utf-8">
      3 <title>CSS Test: invalidation of class changes when the sheet the style depends on goes away</title>
      4 <link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io">
      5 <link rel="help" href="https://drafts.csswg.org/selectors-4/#invalid">
      6 <link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1432850">
      7 <script src="/resources/testharness.js"></script>
      8 <script src="/resources/testharnessreport.js"></script>
      9 <style>
     10  body { background: green; }
     11 </style>
     12 <style id="style">
     13  .red { background: red; }
     14 </style>
     15 <body class="red">
     16 Should have a green background.
     17 <script>
     18 test(() => {
     19  document.body.offsetTop;
     20  assert_equals(getComputedStyle(document.body).backgroundColor, "rgb(255, 0, 0)");
     21  document.body.className = "";
     22  style.remove();
     23  assert_equals(getComputedStyle(document.body).backgroundColor, "rgb(0, 128, 0)");
     24 }, "Style should be recomputed correctly when the stylesheet it depends on goes away");
     25 </script>
     26 </body>