tor-browser

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

test_bug1203766.html (3081B)


      1 <!DOCTYPE html>
      2 <meta charset=utf-8>
      3 <title>Test for bug 1203766</title>
      4 <script src="/tests/SimpleTest/SimpleTest.js"></script>
      5 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
      6 <style>
      7 .x { color: red; }
      8 body > .x { color: green; }
      9 .y { color: green; }
     10 body > .y { display: none; color: red; }
     11 div > .z { color: red; }
     12 .z { color: green; }
     13 .a { color: red; }
     14 body > .a { display: none; color: green; }
     15 .b { display: none; }
     16 .c { color: red; }
     17 .b > .c { color: green; }
     18 .e { color: red; }
     19 .d > .e { color: green; }
     20 .f { color: red; }
     21 .g { color: green; }
     22 .h > .i { color: red; }
     23 .j > .i { color: green; }
     24 </style>
     25 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1203766">Mozilla Bug 1203766</a>
     26 <p id="display"></p>
     27 <div class=y></div>
     28 <div class=b></div>
     29 <pre id="test">
     30 <script class="testbody">
     31 SimpleTest.waitForExplicitFinish();
     32 
     33 addLoadEvent(function() {
     34 
     35  // Element that goes from being out of the document to in the document.
     36  var e = document.createElement("div");
     37  e.className = "x";
     38  var cs = getComputedStyle(e);
     39  is(cs.color, "");
     40  document.body.appendChild(e);
     41  is(cs.color, "rgb(0, 128, 0)");
     42 
     43  // Element that goes from in the document (and display:none) to out of
     44  // the document.
     45  e = document.querySelector(".y");
     46  cs = getComputedStyle(e);
     47  is(cs.color, "rgb(255, 0, 0)");
     48  e.remove();
     49  is(cs.color, "");
     50 
     51  // Element that is removed from an out-of-document tree.
     52  e = document.createElement("div");
     53  f = document.createElement("span");
     54  f.className = "z";
     55  e.appendChild(f);
     56  cs = getComputedStyle(f);
     57  is(cs.color, "");
     58  f.remove();
     59  is(cs.color, "");
     60 
     61  // Element going from not in document to in document and display:none.
     62  e = document.createElement("div");
     63  e.className = "a";
     64  cs = getComputedStyle(e);
     65  is(cs.color, "");
     66  document.body.appendChild(e);
     67  is(cs.color, "rgb(0, 128, 0)");
     68 
     69  // Element going from not in document to in document and child of
     70  // display:none element.
     71  e = document.createElement("div");
     72  e.className = "c";
     73  cs = getComputedStyle(e);
     74  is(cs.color, "");
     75  document.querySelector(".b").appendChild(e);
     76  is(cs.color, "rgb(0, 128, 0)");
     77 
     78  // Element that is added to an out-of-document tree.
     79  e = document.createElement("div");
     80  e.className = "d";
     81  f = document.createElement("span");
     82  f.className = "e";
     83  cs = getComputedStyle(f);
     84  is(cs.color, "");
     85  e.appendChild(f);
     86  is(cs.color, "");
     87 
     88  // Element that is outside the document when an attribute is modified to
     89  // cause a different rule to match.
     90  e = document.createElement("div");
     91  e.className = "f";
     92  cs = getComputedStyle(e);
     93  is(cs.color, "");
     94  e.className = "g";
     95  is(cs.color, "");
     96 
     97  // Element that is outside the document when an ancestor is modified to
     98  // cause a different rule to match.
     99  e = document.createElement("div");
    100  e.className = "h";
    101  f = document.createElement("span");
    102  f.className = "i";
    103  e.appendChild(f);
    104  cs = getComputedStyle(f);
    105  is(cs.color, "");
    106  e.className = "j";
    107  is(cs.color, "");
    108 
    109  SimpleTest.finish();
    110 });
    111 </script>
    112 </pre>