summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/editing/dnd/events/events-non-draggable-001-manual.html
blob: 0315ccdc86aa8fcd767965064fed8482f45edb0f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<!DOCTYPE html>
<meta charset='utf-8'>
<title>drag &amp; drop – events should not fire with non-draggable elements – 001</title>
<style type="text/css">
  div {
    height: 200px;
    width: 200px;
    background-color: orange;
    position: absolute;
    top: 8px;
    left: 8px;
  }
  div + p {
    margin-top: 220px;
  }
</style>

<script>
window.onload = function() {

  var elem = document.getElementsByTagName('div')[0];
  var pass = true;

  function fail() {
    pass = false;
  }

  elem.addEventListener('drag',fail,false);
  elem.addEventListener('dragend',fail,false);
  elem.addEventListener('dragenter',fail,false);
  elem.addEventListener('dragleave',fail,false);
  elem.addEventListener('dragover',fail,false);
  elem.addEventListener('dragstart',fail,false);
  elem.addEventListener('drop',fail,false);

  elem.ondrag = fail;
  elem.ondragend = fail;
  elem.ondragenter = fail;
  elem.ondragleave = fail;
  elem.ondragover = fail;
  elem.ondragstart = fail;
  elem.ondrop = fail;

  elem.onmouseup = function () {
    setTimeout(function () {
      if (pass == true) {
        document.body.innerHTML = 'PASS';
      } else {
        document.body.innerHTML = 'FAIL';
      }
    }, 100 );
  };

}
</script>

<div></div>

<p>Click once on the orange box above, without moving the mouse while
clicking. The word &quot;PASS&quot; should appear.</p>