blob: 57c3b9b6986ca1661d3bab61c012752b645198ee [file] [log] [blame]
<!DOCTYPE html>
<html>
<body>
<p>This test ensures inserting empty string does not move the caret.</p>
<p>The caret is placed at 5th pos and the empty html is added. The test passes if the caret is positioned at the same position after the execution insertion command.</p>
<div id="content" contenteditable="true">abcdefghijklmnopqrstuvwxyz</div>
<div id="console"></div>
<script src="../../resources/js-test.js"></script>
<script>
if (window.testRunner) {
testRunner.dumpAsText();
var selection = window.getSelection();
var div = document.getElementById("content");
var text = div.firstChild;
selection.collapse(text, 5);
document.execCommand('InsertHTML', false, "");
shouldBe("window.getSelection().baseOffset", "5");
}
</script>
</body>
</html>