6 var log
= document
.getElementById('log');
7 log
.appendChild(document
.createTextNode(text
));
8 log
.appendChild(document
.createElement('br'));
11 function dragStartTest(e
) {
12 e
.dataTransfer
.setData('text/plain', 'dragstart test');
13 if (event
.dataTransfer
.types
.indexOf('text/plain') < 0 ||
14 event
.dataTransfer
.getData('text/plain') != 'dragstart test')
15 log('dragstart: FAILED');
17 log('dragstart: SUCCESS');
21 if (!window
.testRunner
)
23 testRunner
.dumpAsText();
25 var draggedElement
= document
.getElementById('draggedElement');
26 var x
= draggedElement
.offsetLeft
+ draggedElement
.offsetWidth
/ 2;
27 var y
= draggedElement
.offsetTop
+ draggedElement
.offsetHeight
/ 2;
29 eventSender
.mouseMoveTo(x
, y
);
30 eventSender
.mouseDown();
31 eventSender
.leapForward(100);
32 eventSender
.mouseMoveTo(x
+ 100, y
+ 100);
33 eventSender
.mouseUp();
37 <body onload=
"runTest()">
38 <p>Simple test that data set during a dragstart event can be read back. To run
39 the test manually, simply start dragging the 'Drag Me' element below.
40 <div id=
"draggedElement" draggable=
"true" ondragstart=
"dragStartTest(event)">Drag Me
</div>