tor-browser

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

007.html (1581B)


      1 <!doctype html>
      2 <html>
      3  <head>
      4    <title>Dropzone should not affect the dropEffect seen by dragenter and dragover</title>
      5    <style type="text/css">
      6 div:first-child {
      7  height: 100px;
      8  width: 100px;
      9  background: orange;
     10  display: inline-block;
     11 }
     12 div:first-child + div {
     13  height: 100px;
     14  width: 100px;
     15  background: blue;
     16  display: inline-block;
     17 }
     18    </style>
     19    <script type="text/javascript">
     20 window.onload = function () {
     21  var drag = document.getElementsByTagName('div')[0];
     22  drag.ondragstart = function (e) {
     23    e.dataTransfer.setData('text','hello');
     24    e.dataTransfer.effectAllowed = 'all';
     25  };
     26  var drop = document.getElementsByTagName('div')[1], dragenter, dragover;
     27  drop.ondragenter = function (e) {
     28    dragenter = e.dataTransfer.dropEffect;
     29  };
     30  drop.ondragover = function (e) {
     31    dragover = e.dataTransfer.dropEffect;
     32  };
     33  drop.ondrop = function (e) {
     34    var sequence = ([dragenter,dragover,e.dataTransfer.dropEffect]).join('=&gt;')
     35    var desiredsequence = (['copy','copy','link']).join('=&gt;')
     36    if( sequence == desiredsequence ) {
     37      document.getElementsByTagName('div')[2].innerHTML = 'PASS';
     38    } else {
     39      document.getElementsByTagName('div')[2].innerHTML = 'FAIL, got:<br>'+sequence+'<br>instead of:<br>'+desiredsequence;
     40    }
     41  };
     42 };
     43    </script>
     44  </head>
     45  <body>
     46 
     47    <div draggable="true"></div>
     48    <div dropzone="link string:text/plain"></div>
     49    <div>&nbsp;</div>
     50    <p>Drag the orange square onto the blue square and release it.</p>
     51    <noscript><p>Enable JavaScript and reload</p></noscript>
     52 
     53  </body>
     54 </html>