|
1 <!DOCTYPE HTML><html><head> |
|
2 <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script> |
|
3 </head> |
|
4 <body> |
|
5 <div contentEditable="true" id="div" spellcheck="false"><p id="p">BC</p></div> |
|
6 <script> |
|
7 // Position the caret before the "B" |
|
8 var div = document.getElementById('div'); |
|
9 div.focus(); |
|
10 var p = document.getElementById('p'); |
|
11 var sel = window.getSelection(); |
|
12 sel.removeAllRanges(); |
|
13 var range = document.createRange(); |
|
14 range.setStart(p.firstChild, 0) |
|
15 range.setEnd(p.firstChild, 0); |
|
16 sel.addRange(range); |
|
17 |
|
18 sendKey('UP'); // move UP |
|
19 sendChar('A'); // insert "A" |
|
20 </script> |
|
21 </body> |
|
22 </html> |