007.html (1374B)
1 <!doctype html> 2 <title>Alert during drag</title> 3 <style> 4 body > div { 5 height: 200px; 6 width: 200px; 7 background-color: orange; 8 display: inline-block; 9 } 10 </style> 11 <script type="text/javascript"> 12 window.onload = function () { 13 var orange = document.getElementsByTagName('div')[0], blue = document.getElementsByTagName('div')[1], hasfired = false; 14 orange.ondragstart = function (e) { 15 e.dataTransfer.setData('text','PASS'); 16 e.dataTransfer.effectAllowed = 'all'; 17 }; 18 orange.ondrag = function (e) { 19 if( hasfired ) { return; } 20 hasfired = true; 21 alert('JS alert'); 22 }; 23 }; 24 </script> 25 <div draggable="true"></div> 26 27 <ol> 28 <li>Drag the orange square downwards until the drag placeholder appears.</li> 29 <li>An alert may appear - release the mouse over the page, not the dialog. Dismiss it (you may need to use keyboard or mouse gestures such as gesture-down,gesture-right). If it does not appear, release the drag.</li> 30 <li>The mouse cursor may continue to show that a drag is in operation. If so, attempt to select some of this text with the mouse before continuing to the text step.</li> 31 <li>Fail if the mouse continues to show that a drag is in operation.</li> 32 <li>Try to select some text in this sentence. Fail if it is not possible.</li> 33 <li>Try to drag the orange square downwards again. Fail if that is not possible.</li> 34 </ol>