<div style="font-size: 36px;">Double-clicking anywhere on this word: <div><span id="target">@
#8#5</span></div> should select it in its entirety.</div>
<pre id="console"></pre>
<script>
    function log(message)
    {
        var console = document.getElementById("console");
        console.appendChild(document.createTextNode(message + "\n"));
    }

    if (window.testRunner) {
        var target = document.getElementById("target");
        testRunner.dumpAsText();
        var y = target.offsetTop + target.offsetHeight / 2;
        var x;
        var selection = getSelection();
        var failed = false;
        for (x = 0; x < target.offsetWidth; x += 7) {
            selection.empty();
            eventSender.mouseMoveTo(x, y);
            eventSender.mouseDown();
            eventSender.mouseUp();
            eventSender.mouseDown();
            eventSender.mouseUp();
            var from = selection.anchorOffset;
            var to = selection.focusOffset;
            if (from != 0 || to != 8) {
                log("FAIL: double-clicking at (" + x + ", " + y + ") selected offsets " + from + " to " + to + ".");
                failed = true;
            }
        }

        if (!failed)
            log("PASS");
    }
</script>
