blob: a55db40f1076338dd273413b4c7bfbaa02c77b08 [file] [log] [blame]
<script>
if (window.layoutTestController)
layoutTestController.dumpEditingCallbacks();
</script>
<script>
function log(str) {
var li = document.createElement("li");
li.appendChild(document.createTextNode(str));
var console = document.getElementById("console");
console.appendChild(li);
}
function runTest() {
try {
if (window.layoutTestController)
window.layoutTestController.dumpAsText();
var selection = window.getSelection();
var bodyElement = document.getElementById("test");
var htmlElement = bodyElement.parentNode;
if (selection.setBaseAndExtent)
selection.setBaseAndExtent(bodyElement, 1, htmlElement, 3);
else
throw("Couldn't set a selection.");
if (selection.toString) {
var string = selection.toString();
if (string != "\nbbbb")
throw("toString returned unexpected result");
log("success");
} else
throw("Selection::toString() not supported");
} catch(e) {
log("Test Failed. Error was: " + e);
}
}
</script>
<body id="test" contenteditable>aaaa<object></object><div>bbbb</div>
<ul id="console"></ul>
<script>runTest();</script>
</body>