Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / editing / selection / keep-selection-after-set-focus.html
blob55ca2a3d09a1a6d8b6d980aaab4579a30a8e69f9
1 <!DOCTYPE html>
2 <script src="../../resources/js-test.js"></script>
3 <div id="container">
4 <p contenteditable id="sample">01234567</p>
5 <button id="button">This is a button</button>
6 </div>
7 <script>
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 = '';
19 </script>