| OLD | NEW |
| (Empty) | |
| 1 <!DOCTYPE html> |
| 2 <body> |
| 3 <script src="../../resources/testharness.js"></script> |
| 4 <script src="../../resources/testharnessreport.js"></script> |
| 5 <input id="notFocused" value="foo"> |
| 6 <input id="focused" value="a"> |
| 7 <script> |
| 8 test(() => { |
| 9 var notFocused = document.getElementById('notFocused'); |
| 10 var focused = document.getElementById('focused'); |
| 11 var selection = window.getSelection(); |
| 12 selection.removeAllRanges(); |
| 13 focused.focus(); |
| 14 |
| 15 var originalAnchorNode = selection.anchorNode; |
| 16 var originalAnchorOffset = selection.anchorOffset; |
| 17 notFocused.setSelectionRange(3, 3); |
| 18 assert_equals(selection.anchorNode, originalAnchorNode); |
| 19 assert_equals(selection.anchorOffset, originalAnchorOffset); |
| 20 }, 'setSelectionRange() should not update FrameSelection if the target element i
s not focused.'); |
| 21 |
| 22 test(() => { |
| 23 var notFocused = document.getElementById('notFocused'); |
| 24 var focused = document.getElementById('focused'); |
| 25 var selection = window.getSelection(); |
| 26 selection.removeAllRanges(); |
| 27 focused.focus(); |
| 28 |
| 29 var originalAnchorNode = selection.anchorNode; |
| 30 var originalAnchorOffset = selection.anchorOffset; |
| 31 notFocused.setRangeText('barrr', 0, 3, 'select'); |
| 32 assert_equals(selection.anchorNode, originalAnchorNode); |
| 33 assert_equals(selection.anchorOffset, originalAnchorOffset); |
| 34 }, 'setRangeText() should not update FrameSelection if the target element is not
focused.'); |
| 35 </script> |
| 36 </body> |
| OLD | NEW |