OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 | 3 |
4 <body> | 4 <body> |
5 <p>This test ensures inserting empty string does not move the caret.</p> | 5 <p>This test ensures inserting empty string does not move the caret.</p> |
6 <p>The caret is placed at 5th pos and the empty html is added. The test passes i
f the caret is positioned at the same position after the execution insertion com
mand.</p> | 6 <p>The caret is placed at 5th pos and the empty html is added. The test passes i
f the caret is positioned at the same position after the execution insertion com
mand.</p> |
7 | 7 |
8 <div id="content" contenteditable="true">abcdefghijklmnopqrstuvwxyz</div> | 8 <div id="content" contenteditable="true">abcdefghijklmnopqrstuvwxyz</div> |
9 <div id="console"></div> | 9 <div id="console"></div> |
10 | 10 |
11 <script src="../../fast/js/resources/js-test-pre.js"></script> | 11 <script src="../../resources/js-test.js"></script> |
12 <script> | 12 <script> |
13 | 13 |
14 if (window.testRunner) { | 14 if (window.testRunner) { |
15 testRunner.dumpAsText(); | 15 testRunner.dumpAsText(); |
16 | 16 |
17 var selection = window.getSelection(); | 17 var selection = window.getSelection(); |
18 var div = document.getElementById("content"); | 18 var div = document.getElementById("content"); |
19 var text = div.firstChild; | 19 var text = div.firstChild; |
20 | 20 |
21 selection.setPosition(text, 5); | 21 selection.setPosition(text, 5); |
22 document.execCommand('InsertHTML', false, ""); | 22 document.execCommand('InsertHTML', false, ""); |
23 | 23 |
24 shouldBe("window.getSelection().baseOffset", "5"); | 24 shouldBe("window.getSelection().baseOffset", "5"); |
25 } | 25 } |
26 | 26 |
27 </script> | 27 </script> |
28 | 28 |
29 </body> | 29 </body> |
30 </html> | 30 </html> |
OLD | NEW |