blob: cbe6e92cd1c3d6186ce3e7d9b023a94218bfcb53 [file] [log] [blame]
<!DOCTYPE html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<div contenteditable id="root" class="editing">
<span id="sample">foo</span><span id="start" style="display: none;">bar</span> baz
</div>
<div id="log"></div>
<script>
test(function() {
var selection = window.getSelection();
var sample = document.getElementById('sample');
selection.collapse(document.getElementById('start').firstChild, 2);
assert_true(selection.isCollapsed, 'isCollapsed');
assert_equals(selection.anchorNode, document.getElementById('start').firstChild, 'DOM anchorNode');
assert_equals(selection.anchorOffset, 2, 'DOM anchorOffset');
assert_own_property(window, 'internals');
assert_equals(internals.visibleSelectionAnchorNode, sample.lastChild, 'Canonicalized anchorNode');
assert_equals(internals.visibleSelectionAnchorOffset, 3, 'Canoincalized anchorOffset');
});
</script>