<p>
    Test for <i><a href="http://bugs.webkit.org/show_bug.cgi?id=14347">http://bugs.webkit.org/show_bug.cgi?id=14347</a>
    REGRESSION (r21291): Initiating a drag near the edge of a selection deselects it</i>.
</p>
<p>
    Drag the selected letter W into the yellow rectangle.
</p>
<div id="source" style="font-size: 72px">W</div>
<div contenteditable="true" id="destination" style="font-size: 72px; background: #ffc;"></div>
<script>
    var source = document.getElementById("source");
    var destination = document.getElementById("destination");

    getSelection().setBaseAndExtent(source, 0, source, 1);

    var x = document.body.offsetLeft + source.offsetLeft + 1;
    var srcY = document.body.offsetTop + source.offsetTop + source.offsetHeight / 2;
    var dstY = document.body.offsetTop + destination.offsetTop + source.offsetHeight / 2;

    if (window.eventSender) {
        eventSender.mouseMoveTo(x, srcY);
        eventSender.mouseDown();
        eventSender.leapForward(1000);
        eventSender.mouseMoveTo(x, dstY);
        eventSender.mouseUp();
    }
</script>
