OLD | NEW |
(Empty) | |
| 1 <!doctype html> |
| 2 <html contenteditable> |
| 3 <script src="../../resources/testharness.js"></script> |
| 4 <script src="../../resources/testharnessreport.js"></script> |
| 5 <body> |
| 6 This tests to see where the selection is set when an html element is focused. |
| 7 <br> |
| 8 We set it inside the body because we don't want to allow editing outside the |
| 9 body. |
| 10 <div id="log"></div> |
| 11 </body> |
| 12 </html> |
| 13 <script> |
| 14 var test = async_test('focus to editable should not scroll'); |
| 15 document.documentElement.addEventListener('focus', function() { |
| 16 var selection = window.getSelection(); |
| 17 var anchor = document.body.firstChild; |
| 18 assert_equals(selection.anchorNode, anchor, 'anchorNode'); |
| 19 assert_equals(selection.anchorOffset, 1, 'anchorOffset'); |
| 20 assert_equals(selection.focusNode, anchor, 'focusNode'); |
| 21 assert_equals(selection.focusOffset, 1, 'focusOffset'); |
| 22 |
| 23 test.done(); |
| 24 }); |
| 25 test.step(function() { |
| 26 document.documentElement.focus(); |
| 27 }); |
| 28 </script> |
OLD | NEW |