OLD | NEW |
| 1 <!DOCTYPE html> |
| 2 <script src="../../resources/testharness.js"></script> |
| 3 <script src="../../resources/testharnessreport.js"></script> |
1 <p>This tests smart paste of a fragment that ends in a select element. There sh
ould be no spaces added because the paste is performed in an empty paragraph.</p
> | 4 <p>This tests smart paste of a fragment that ends in a select element. There sh
ould be no spaces added because the paste is performed in an empty paragraph.</p
> |
2 <div contenteditable="true" id="copy">foo<select><option>1</option><option>2</op
tion><option>3</option></select></div> | 5 <div contenteditable="true" id="copy">foo<select><option>1</option><option>2</op
tion><option>3</option></select></div> |
3 <div contenteditable="true" id="paste"></div> | 6 <div contenteditable="true" id="sample"></div> |
| 7 <div id="log"></div> |
| 8 <script> |
| 9 test(function() { |
| 10 if (window.internals) |
| 11 internals.settings.setEditingBehavior('win'); |
4 | 12 |
5 <script> | 13 var copy = document.getElementById('copy'); |
6 var copy = document.getElementById("copy"); | 14 var paste = document.getElementById('sample'); |
7 var paste = document.getElementById("paste"); | 15 var selection = window.getSelection(); |
8 var sel = window.getSelection(); | |
9 | 16 |
10 sel.collapse(copy, 0); | 17 selection.collapse(copy, 0); |
11 sel.modify("extend", "forward", "word"); | 18 selection.modify('extend', 'forward', 'word'); |
12 sel.modify("extend", "forward", "word"); | 19 selection.modify('extend', 'forward', 'word'); |
13 document.execCommand("Copy"); | 20 document.execCommand('copy'); |
14 | 21 |
15 sel.collapse(paste, 0); | 22 selection.collapse(paste, 0); |
16 document.execCommand("Paste"); | 23 document.execCommand('paste'); |
| 24 |
| 25 assert_equals(sample.innerHTML, 'foo<select><option>1</option><option>2</opt
ion><option>3</option></select>'); |
| 26 assert_true(selection.isCollapsed); |
| 27 assert_equals(selection.anchorNode, sample); |
| 28 assert_equals(selection.anchorOffset, 2); |
| 29 }); |
17 </script> | 30 </script> |
OLD | NEW |