<script>
if (window.testRunner)
     testRunner.dumpEditingCallbacks();
</script>
<p>Only 'bar' should be selected.</p>

<div id="test" style="width: 50px; border: 1px solid black;">foo bar baz foo</div>

<script>
var s = window.getSelection();
var e = document.getElementById("test");

s.setBaseAndExtent(e.firstChild, 4, e.firstChild, 7);
</script>
