<p>This tests for a bug where hitting return after a line break in text that preserves newlines wouldn't do anything.</p> | |
<div id="div" contenteditable="true" style="white-space: pre;">xxx | |
There should be an empty paragraph before this one, and the caret should be at the start of this paragraph.</div> | |
<script> | |
var sel = window.getSelection(); | |
var div = document.getElementById("div"); | |
var text = div.firstChild; | |
sel.setPosition(text, 4); | |
document.execCommand("InsertParagraph"); | |
</script> |