3 <title>drag
& drop – events should not fire with non-draggable elements –
002</title>
4 <style type=
"text/css">
8 background-color: orange
;
14 background-color: navy
;
24 window
.onload = function() {
26 var orange
= document
.getElementsByTagName('div')[0];
27 var blue
= document
.getElementsByTagName('div')[1];
28 var body
= document
.body
;
36 body
.addEventListener('drag',fail
,false);
37 body
.addEventListener('dragend',fail
,false);
38 body
.addEventListener('dragenter',fail
,false);
39 body
.addEventListener('dragleave',fail
,false);
40 body
.addEventListener('dragover',fail
,false);
41 body
.addEventListener('dragstart',fail
,false);
42 body
.addEventListener('drop',fail
,false);
45 body
.ondragend
= fail
;
46 body
.ondragenter
= fail
;
47 body
.ondragleave
= fail
;
48 body
.ondragover
= fail
;
49 body
.ondragstart
= fail
;
52 orange
.addEventListener('drag',fail
,false);
53 orange
.addEventListener('dragend',fail
,false);
54 orange
.addEventListener('dragenter',fail
,false);
55 orange
.addEventListener('dragleave',fail
,false);
56 orange
.addEventListener('dragover',fail
,false);
57 orange
.addEventListener('dragstart',fail
,false);
58 orange
.addEventListener('drop',fail
,false);
61 orange
.ondragend
= fail
;
62 orange
.ondragenter
= fail
;
63 orange
.ondragleave
= fail
;
64 orange
.ondragover
= fail
;
65 orange
.ondragstart
= fail
;
68 blue
.addEventListener('drag',fail
,false);
69 blue
.addEventListener('dragend',fail
,false);
70 blue
.addEventListener('dragenter',fail
,false);
71 blue
.addEventListener('dragleave',fail
,false);
72 blue
.addEventListener('dragover',fail
,false);
73 blue
.addEventListener('dragstart',fail
,false);
74 blue
.addEventListener('drop',fail
,false);
77 blue
.ondragend
= fail
;
78 blue
.ondragenter
= fail
;
79 blue
.ondragleave
= fail
;
80 blue
.ondragover
= fail
;
81 blue
.ondragstart
= fail
;
84 body
.onmouseup = function () {
85 setTimeout(function () {
87 document
.body
.innerHTML
= 'PASS';
89 document
.body
.innerHTML
= 'FAIL';
100 <p>Use your pointing device to drag from the orange box to the blue box. The
101 word
"PASS
" should appear.