blob: 410d75ddbd79dba22ced584cbcd004aba7c87e7a [file] [log] [blame]
<!doctype html>
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<div contenteditable id="anchor"><select><option>One</option></select>blaa</div>
<div id="log"></div>
<script>
test(function() {
var selection = window.getSelection();
var select = document.querySelector('select');
selection.collapse(select, 0);
var anchor = document.getElementById('anchor');
assert_equals(selection.anchorNode, select, 'DOM anchorNode');
assert_equals(selection.anchorOffset, 0, 'DOM anchorOffset');
assert_equals(selection.focusNode, select, 'DOM focusNode');
assert_equals(selection.focusOffset, 0, 'DOM focusOffset');
assert_own_property(window, 'internals');
assert_equals(internals.visibleSelectionAnchorNode, anchor, 'Canonicalized anchorNode');
assert_equals(internals.visibleSelectionAnchorOffset, 0, 'Canonicalized anchorOffset');
assert_equals(internals.visibleSelectionFocusNode, anchor, 'Canonicalized focusNode');
assert_equals(internals.visibleSelectionFocusOffset, 0, 'Canonicalized focusOffset');
}, 'can not place canonicalized caret inside SELECT element');
</script>