2 <script src=
"../../resources/js-test.js"></script>
4 <p contenteditable
id=
"sample">01234567</p>
5 <button id=
"button">This is a button
</button>
8 description('Selection should be kept after focus changed.');
9 var selection
= getSelection();
10 var sample
= document
.getElementById('sample').firstChild
;
11 selection
.collapse(sample
, 3);
12 selection
.extend(sample
, 6);
13 document
.getElementById('button').focus();
14 shouldBe('selection.anchorNode', 'sample');
15 shouldBe('selection.anchorOffset', '3');
16 shouldBe('selection.focusNode', 'sample');
17 shouldBe('selection.focusOffset', '6');
18 document
.getElementById('container').outerHTML
= '';