tor-browser

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

shadow-host-removal-invalidation.html (922B)


      1 <!doctype html>
      2 <title>CSS Test: Invalidation of :host selectors</title>
      3 <link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io">
      4 <link rel="author" title="Mozilla" href="https://mozilla.org">
      5 <link rel="help" href="https://drafts.csswg.org/css-scoping/#host-selector">
      6 <link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1499603">
      7 <script src="/resources/testharness.js"></script>
      8 <script src="/resources/testharnessreport.js"></script>
      9 <div id="host" style="color: green"></div>
     10 <script>
     11 host.attachShadow({ mode: "open" }).innerHTML = `
     12  <style>
     13    :host { color: red !important }
     14  </style>
     15 `;
     16 test(function() {
     17  assert_equals(getComputedStyle(host).color, "rgb(255, 0, 0)");
     18  host.shadowRoot.querySelector("style").remove();
     19  assert_equals(getComputedStyle(host).color, "rgb(0, 128, 0)");
     20 }, ":host rules are properly invalidated when stylesheets are removed");
     21 </script>