019.xhtml (764B)
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 drag is cancelled</title> 5 <script type="application/ecmascript"> 6 function selectText() 7 {window.getSelection().selectAllChildren(document.querySelector('p'))} 8 function dragMe(event) 9 {event.preventDefault();} 10 function dropIt(event) 11 {say('FAIL (no drop should occur after drag is cancelled)')} 12 function say(it) 13 {document.querySelector('pre').appendChild(document.createTextNode(it + '\n'));} 14 </script> 15 </head> 16 <body onload="selectText()" dropzone="copy string:text/plain" ondrop="dropIt(event)"> 17 <p ondrag="dragMe(event)">Try to drag me</p> 18 <p>You should not be able to drop text selection above.</p> 19 <pre/> 20 </body> 21 </html>