tor-browser

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

elementsFromPoint-invalid-cases.html (1688B)


      1 <!DOCTYPE HTML>
      2 <script src="/resources/testharness.js"></script>
      3 <script src="/resources/testharnessreport.js"></script>
      4 <script src="resources/elementsFromPoint.js"></script>
      5 <style>
      6 html {
      7    overflow-y: scroll;
      8    overflow-x: scroll;
      9 }
     10 html, body {
     11    margin: 0;
     12    padding: 0;
     13 }
     14 body {
     15    width: 100%;
     16    height: 100%;
     17 }
     18 #simpleDiv {
     19    width: 200px;
     20    height: 200px;
     21    background-color: rgba(0,255,0,0.5);
     22 }
     23 #beyondTopLeft {
     24    position: absolute;
     25    transform: translate3d(-100px, -100px, 10px);
     26    left: 0;
     27    top: 0;
     28    width: 100px;
     29    height: 100px;
     30    background-color: rgba(0,0,0,0.1);
     31 }
     32 </style>
     33 <body>
     34 <div id="beyondTopLeft"></div>
     35 <div id="simpleDiv"></div>
     36 <script>
     37 test(function() {
     38    assertElementsFromPoint('document', 300, 300, [document.documentElement]);
     39 }, "The root element is the last element returned for otherwise empty queries within the viewport");
     40 
     41 test(function() {
     42    var simpleDiv = document.getElementById('simpleDiv');
     43    var simpleRect = simpleDiv.getBoundingClientRect();
     44    var simpleCoords = (simpleRect.right - 1) + ', ' + (simpleRect.bottom - 1);
     45    assertElementsFromPoint('document', simpleRect.right - 1, simpleRect.bottom - 1,
     46        [simpleDiv, document.body, document.documentElement]);
     47 }, "The root element is the last element returned for valid queries");
     48 
     49 test(function() {
     50    assertElementsFromPoint('document', window.innerWidth + 1, window.innerHeight + 1, []);
     51    assertElementsFromPoint('document', -1, -1, []);
     52    assertElementsFromPoint('document', 1, -1, []);
     53    assertElementsFromPoint('document', -1, 1, []);
     54 }, "An empty sequence is returned for queries outside the viewport");
     55 </script>
     56 </body>