blob: 11394356ff5e20957031324a5f7d24ed0a0945d3 [file] [log] [blame]
<p>This tests for a bug where delete would crash if a node just after the selection to delete is removed in a DOMNodeRemoved event handler for the last node in the selection to delete.</p>
<div id="div" contenteditable="true">foo<span id="foo">x</span><span id="removeme">y</span></div>
<p id="console"></p>
<script>
if (window.layoutTestController)
window.layoutTestController.dumpAsText();
function log(message) {
var console = document.getElementById("console");
var text = document.createTextNode(message);
console.appendChild(text);
}
function removeHandler() {
var removeme = document.getElementById("removeme");
removeme.parentNode.removeChild(removeme);
}
document.getElementById("foo").addEventListener("DOMNodeRemoved", removeHandler);
var sel = window.getSelection();
sel.setBaseAndExtent( document.getElementById('foo'), 0, document.getElementById('foo'), 1 );
document.execCommand("Delete");
log(document.getElementById('div').innerHTML);
</script>
PASS