016.xhtml (1180B)
1 <?xml version="1.0" encoding="utf-8"?> 2 <html xmlns="http://www.w3.org/1999/xhtml"> 3 <head> 4 <title>Selection drag and drop: events after dragenter is cancelled</title> 5 <script type="application/ecmascript"> 6 function selectText() 7 {window.getSelection().selectAllChildren(document.querySelector('p'))} 8 function start(event) 9 {event.preventDefault();} 10 function dragMe(event) 11 {say('FAIL (drag event should not fire if dragstart is cancelled)');} 12 function enterBody(event) 13 {event.preventDefault(); 14 say('FAIL (dragover event should not fire if dragstart is cancelled)');} 15 function overBody(event) 16 {event.preventDefault(); 17 say('FAIL (dragover event should not fire if dragstart is cancelled)');} 18 function dropIt(event) 19 {say('FAIL (drop event should not fire if dragstart is cancelled)');} 20 function say(it) 21 {document.querySelector('pre').appendChild(document.createTextNode(it + '\n'));} 22 </script> 23 </head> 24 <body onload="selectText()" ondragenter="enterBody(event)" ondragover="overBody(event)" ondrop="dropIt(event)"> 25 <p ondragstart="start(event)" ondrag="dragMe(event)">Try to drag me</p> 26 <p>You should not be able to drag text selection above.</p> 27 <pre/> 28 </body> 29 </html>