1 <div id=
"dragme">This test verifies that we can get text/html from the drag object
2 during an ondrop event. This test requires DRT.
</div>
4 <div id=
"droptarget" contenteditable
ondragover=
"dragover(event)" ondrop=
"drop(event)" style=
"height:200px"></div>
5 <div id=
"results">FAIL
</div>
9 testRunner
.dumpAsText();
12 function removeFontName(text
)
16 return text
.replace(/font-family: [^;]+;\s*/g, "");
21 console
.log("text/plain: " + ev
.dataTransfer
.getData("text/plain"));
22 // Remove the font name because it varies depending on the platform.
23 console
.log("text/html: " + removeFontName(ev
.dataTransfer
.getData("text/html")));
24 if (ev
.dataTransfer
.getData("text/html") != undefined)
25 document
.getElementById("results").innerHTML
= "PASS";
30 // drop() will only get called if we prevent the default dragover event.
34 var dragMe
= document
.getElementById("dragme");
35 var startX
= dragMe
.offsetLeft
+ 10;
36 var startY
= dragMe
.offsetTop
+ 5;
37 var dropTarget
= document
.getElementById("droptarget");
38 var endX
= dropTarget
.offsetLeft
+ 10;
39 var endY
= dropTarget
.offsetTop
+ dropTarget
.offsetHeight
/ 2;
41 var selection
= window
.getSelection();
42 selection
.collapse(dragMe
, 0);
43 selection
.modify("extend", "forward", "sentence");
45 eventSender
.mouseMoveTo(startX
, startY
);
46 eventSender
.mouseDown();
47 eventSender
.leapForward(200);
48 eventSender
.mouseMoveTo(endX
, endY
);
49 eventSender
.mouseUp();