tor-browser

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

elementFromPoint-002.html (1202B)


      1 <!doctype html>
      2 <meta charset=utf-8>
      3 <title>Checking whether dynamic changes to visibility interact correctly with
      4  table anonymous boxes</title>
      5 <script src=/resources/testharness.js></script>
      6 <script src=/resources/testharnessreport.js></script>
      7 <style>
      8 #overlay {
      9  display: table;
     10  position: absolute;
     11  top: 0;
     12  left: 0;
     13  width: 100%;
     14  height: 100%;
     15  background: white;
     16  z-index: 999
     17 }
     18 
     19 #wrapper { position: relative; }
     20 </style>
     21 <div id=log></div>
     22 <div id="wrapper">
     23  <div id="overlay"><div></div></div>
     24  <div id="target">Some text</div>
     25 </div>
     26 <script>
     27  test(function() {
     28    var t = document.querySelector("#target");
     29    var rect = t.getBoundingClientRect();
     30    var hit = document.elementFromPoint(rect.x + rect.width/2,
     31                                        rect.y + rect.height/2);
     32    assert_equals(hit, t.previousElementSibling,
     33                  "Should hit the overlay first.");
     34    t.previousElementSibling.style.visibility = "hidden";
     35    hit = document.elementFromPoint(rect.x + rect.width/2,
     36                                    rect.y + rect.height/2);
     37    assert_equals(hit, t,
     38                  "Should hit our target now that the overlay is hidden.");
     39  });
     40 </script>