4 <style type="text/css">
5 span, div { display: block; }
17 <p>This test ensures we clear the drag state at the end of each drag. To test manually, drag the green box below twice.
18 You should observe the same list of events in the same order twice.</p>
20 <span>Drag me down twice!</span>
27 document.getElementById('log').textContent += event.target.localName + ':' + this.localName + ':' + event.type + '\n';
30 function setLog(log) {
31 var value = document.getElementById('log').textContent;
32 document.getElementById('log').textContent = log;
36 var div = document.querySelector('div');
37 div.addEventListener('dragover', function (event) { event.preventDefault(); });
38 div.addEventListener('dragenter', log);
39 div.addEventListener('dragleave', log);
41 var span = document.querySelector('span');
42 span.addEventListener('dragenter', log);
43 span.addEventListener('dragleave', log);
46 var x = span.offsetLeft + span.offsetWidth / 2;
47 eventSender.mouseMoveTo(x, span.offsetTop + span.offsetHeight / 2);
48 eventSender.mouseDown();
49 eventSender.mouseMoveTo(x, span.offsetTop + 2 * span.offsetHeight / 3);
50 eventSender.leapForward(200);
51 eventSender.mouseMoveTo(x, span.offsetTop + 3 * span.offsetHeight / 2);
52 eventSender.leapForward(200);
53 eventSender.mouseUp();
56 if (window.eventSender) {
57 testRunner.dumpAsText();
58 getSelection().selectAllChildren(span);
60 var firstLog = setLog('');
62 var secondLog = setLog('PASS');
63 if (firstLog != secondLog)
64 setLog('FAIL:\nFirst drag:\n' + firstLog + '\nSecond drag:\n' + secondLog);