blob: 803818ea26116e4c3e24478ff1f94207e64f77ca [file] [log] [blame]
<p>This tests to see that the Selection object's properties return valid DOM positions (not our internal editing positions). We should be able to create Range objects out of those positions w/o issue.</p>
<div id="div" contenteditable="true">foo<img src="../resources/abe.png"><br></div>
<script>
if (window.testRunner)
window.testRunner.dumpAsText();
div = document.getElementById("div");
selection = window.getSelection();
try {
selection.setBaseAndExtent(div, 0, div, 2);
extentNode = selection.extentNode;
extentOffset = selection.extentOffset;
range = document.createRange();
range.setStart(extentNode, extentOffset);
range.setEnd(extentNode, extentOffset);
selection.removeAllRanges();
selection.addRange(range);
alert("Success");
} catch (e) {
alert("Failed: " + e);
}
</script>