blob: d115b5e38a252bad10be1330b2c1f721745435d5 [file] [log] [blame]
<script>
if (window.testRunner)
testRunner.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.testRunner)
window.testRunner.dumpAsText();
var selection = window.getSelection();
var bodyElement = document.getElementById("test");
var htmlElement = bodyElement.parentNode;
if (selection.setBaseAndExtent)
selection.setBaseAndExtent(bodyElement, 1, htmlElement, 2);
else
throw("Couldn't set a selection.");
if (selection.toString) {
var string = selection.toString();
if (string != "\nbbbb")
throw("toString returned unexpected result: \"" + string.replace("\n", "\\n") + "\"");
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>