<!DOCTYPE html>
<html>
<body>
<p>This test verifies that selection begins at the mouse-down position. Select rapidly inside the box blow. The first letter should be selected.</p>
<div id='text' style="border: solid 1px; padding: 10px;">The first part of this text should be selected.</div>
<script>
if (window.testRunner)
    testRunner.dumpAsText();

if (window.eventSender) {
    var div = document.getElementById('text');
    var x = div.offsetLeft + 1;
    var y = div.offsetTop + div.offsetHeight / 2;

    eventSender.mouseMoveTo(x, y);
    eventSender.mouseDown();

    eventSender.mouseMoveTo(x + div.offsetWidth - 5, y);
    eventSender.mouseUp();

    var sel = window.getSelection();
    document.write(sel.anchorNode == sel.focusNode && sel.anchorOffset < sel.focusOffset ? 'PASS' : 'FAIL');
}
</script>
</body>
</html>
