| testRunner.dumpEditingCallbacks(); |
| var li = document.createElement("li"); |
| li.appendChild(document.createTextNode(str)); |
| var console = document.getElementById("console"); |
| window.testRunner.dumpAsText(); |
| var selection = window.getSelection(); |
| var element = document.getElementById("test"); |
| if (selection.setBaseAndExtent) |
| selection.setBaseAndExtent(element, 0, element, 1); |
| else if (selection.selectAllChildren) |
| selection.selectAllChildren(element); |
| throw("Couldn't set a selection."); |
| if (selection.toString) { |
| var string = selection.toString(); |
| throw("Implicit toString call did not match explicit call"); |
| if (string != "hello world") |
| throw("Selection::toString() returned incorrect results."); |
| throw("Selection::toString() not supported"); |
| log("Test Failed. Error was: " + e); |
| <p>This tests Selection::toString(): that it exists, that it returns the same result as the implicit toString call, and that it returns the correct results.</p> |
| <div id="test" style="border: 1px solid black;">hello world</div> |
| <script>runTest();</script> |