tor-browser

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

getComputedStyle-display-none-002.html (1260B)


      1 <!doctype html>
      2 <meta charset="utf-8">
      3 <title>CSSOM: getComputedStyle gets invalidated for display: none elements (rules)</title>
      4 <link rel="help" href="https://drafts.csswg.org/cssom/#dom-window-getcomputedstyle">
      5 <link rel="help" href="https://bugs.webkit.org/show_bug.cgi?id=186882">
      6 <link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io">
      7 <script src=/resources/testharness.js></script>
      8 <script src=/resources/testharnessreport.js></script>
      9 <style>
     10 #undisplayed {
     11  display: none;
     12  color: red;
     13 }
     14 .sibling + #undisplayed {
     15  color: green;
     16 }
     17 
     18 .sibling + #undisplayed > div {
     19  color: yellow;
     20 }
     21 </style>
     22 <div id="helper"></div>
     23 <div id="undisplayed"><div id="child"></div></div>
     24 <script>
     25  test(function() {
     26    let undisplayed_style = getComputedStyle(undisplayed);
     27    let undisplayed_child_style = getComputedStyle(child);
     28    assert_equals(undisplayed_style.color, "rgb(255, 0, 0)");
     29    assert_equals(undisplayed_child_style.color, "rgb(255, 0, 0)");
     30    helper.classList.add("sibling");
     31    assert_equals(undisplayed_style.color, "rgb(0, 128, 0)");
     32    assert_equals(undisplayed_child_style.color, "rgb(255, 255, 0)");
     33  }, "getComputedStyle gets invalidated in display: none subtrees due to rule matching changes");
     34 </script>