<script src="../../resources/dump-as-markup.js" type="text/javascript"></script>
<body>
<div id="test" contenteditable>hello</div>
<script>

var div = document.getElementById('test');

window.getSelection().setBaseAndExtent(div.firstChild, 2, div.firstChild, 2);
document.execCommand('InsertParagraph', true, null);
window.getSelection().setBaseAndExtent(div.firstChild, 0, div.firstChild, 2);
document.execCommand('bold', false, null);

Markup.description("This test splits a text node by inserting a new paragraph and bolds the the first half.\nAfter undoing these two steps, it removes the text node, and then redo. The test should not crash. (See bug 42941).")
Markup.dump(div, "before undo");
document.execCommand('undo', false, null);
document.execCommand('undo', false, null);

Markup.dump(div, "after undo");
div.removeChild(div.firstChild);
Markup.dump(div, "after node removal");

document.execCommand('redo', false, null);
document.execCommand('redo', false, null);
Markup.dump(div, "after redo");

</script>
</body>
