blob: bec747a2d9e4760d697f887c966c04089b95cabb [file] [log] [blame]
<body>
<div id="container">
<div contenteditable="true" id="work">
<span id="sample"><img width="70" height="70" style="background: #DEF"><br>[click here, hold backspace]</span>
</div>
</div>
</div>
<script src="../../resources/js-test.js"></script>
<script>
function $(id) { return document.getElementById(id); }
var range = document.createRange();
range.setStartAfter($('work').querySelector('br'));
var selection = window.getSelection();
selection.removeAllRanges();
selection.addRange(range);
document.execCommand('Delete');
shouldBeEqualToString('$("sample").innerHTML', '<img width="70" height="70" style="background: #DEF">[click here, hold backspace]');
shouldBeEqualToString('selection.type', 'Caret');
shouldBe('selection.anchorNode', '$("sample")');
shouldBe('selection.anchorOffset', '1');
if (window.testRunner)
$('container').outerHTML = '';
</script>
</body>