blob: f0f7ba5d3ef07e40bf0f8b97fdc4a032dae860e0 [file] [log] [blame]
<div id="container">
<p id="description"></p>
<div id="sample"><span contenteditable="true">foobar</span></div>
</div>
<div id="console"></div>
<script src="../../resources/js-test-pre.js"></script>
<script>
description('Selection should be updated after set innerHTML.');
var sample = document.getElementById('sample');
var selection = window.getSelection();
document.addEventListener('blur', function () {
selection.selectAllChildren(sample.firstChild);
}, true);
selection.selectAllChildren(sample.firstChild);
sample.firstChild.focus();
sample.innerHTML = '';
shouldBe('selection.anchorOffset', '0');
shouldBe('selection.focusOffset', '0');
if (window.testRunner)
document.getElementById('container').outerHTML = '';
</script>
<script src="../../resources/js-test-post.js"></script>