OLD | NEW |
1 <html> | 1 <!DOCTYPE html> |
2 <head> | 2 <script src="../../resources/testharness.js"></script> |
3 | 3 <script src="../../resources/testharnessreport.js"></script> |
4 <style> | |
5 .editing { | |
6 border: 2px solid red; | |
7 padding: 12px; | |
8 font-size: 24px; | |
9 } | |
10 </style> | |
11 <script src=../editing.js language="JavaScript" type="text/JavaScript" ></script
> | |
12 | |
13 <script> | |
14 | |
15 function editingTest() { | |
16 moveSelectionForwardByCharacterCommand(); | |
17 moveSelectionForwardByCharacterCommand(); | |
18 for (i = 0; i < 157; i++) { | |
19 extendSelectionForwardByCharacterCommand(); | |
20 } | |
21 } | |
22 | |
23 </script> | |
24 | |
25 <title>Editing Test</title> | |
26 </head> | |
27 <body> | 4 <body> |
28 <div contenteditable id="root" class="editing"> | 5 <div contenteditable id="root" class="editing"> |
29 <span id="test"><i>F and seven</i> years <b> as </b>our fathers f upon this | 6 <span id="span"><i>F and seven</i> years <b> as </b>our fathers f upon this |
30 continent, a new nation, conceived in Liberty, and
dedicated to the | 7 continent, a new nation, conceived in Liberty, and
dedicated to the |
31 proposition that all | 8 proposition that all |
32 <br>men are created equal.</span> | 9 <br>men are created equal.</span> |
33 </div> | 10 </div> |
34 | 11 <div id="log"></div> |
35 <script> | 12 <script> |
36 runEditingTest(); | 13 test(function () { |
| 14 var selection = getSelection(); |
| 15 selection.collapse(span.firstChild.firstChild, 0); |
| 16 selection.modify("move", "forward", "character"); |
| 17 selection.modify("move", "forward", "character"); |
| 18 for (i = 0; i < 157; i++) { |
| 19 selection.modify("extend", "forward", "character"); |
| 20 } |
| 21 assert_equals(selection.anchorNode, span.firstChild.firstChild); |
| 22 assert_equals(selection.anchorOffset, 5); |
| 23 assert_equals(selection.focusNode, span.childNodes[5]); |
| 24 assert_equals(selection.focusOffset, 21); |
| 25 }); |
37 </script> | 26 </script> |
38 | 27 |
39 </body> | 28 </body> |
40 </html> | |
OLD | NEW |