| <div id="target">All of this should be selected</div><div>None of this should be selected.</div> |
| <p id="result"></p> |
| <script> |
| if (window.testRunner) |
| testRunner.dumpAsText(); |
| |
| var target = document.getElementById("target"); |
| var result = document.getElementById("result"); |
| var sel = getSelection(); |
| sel.setBaseAndExtent(target, 0, target, 1); |
| sel.modify("extend", "forward", "sentence"); |
| var selectedText = sel.toString().trim(); |
| |
| if (selectedText == "All of this should be selected") { |
| result.innerText = "PASS"; |
| } else { |
| result.innerText = "FAIL: Selected range is '" + selectedText + "'"; |
| } |
| </script> |