OLD | NEW |
| (Empty) |
1 <html> | |
2 <head> | |
3 <style> | |
4 textarea { -webkit-appearance: textarea;} | |
5 </style> | |
6 <script> | |
7 function log(msg) { | |
8 document.getElementById('res').innerHTML = document.getElementById('res'
).innerHTML + msg + "<br>"; | |
9 } | |
10 | |
11 function test() { | |
12 if (window.testRunner) | |
13 testRunner.dumpAsText(); | |
14 var ta = document.getElementById('ta'); | |
15 | |
16 log('Calling focus on textarea'); | |
17 ta.focus(); | |
18 log('After focus: textarea selection start: ' + ta.selectionStart + ' en
d: ' + ta.selectionEnd + '<br>'); | |
19 | |
20 log('Calling setSelectionRange on textarea'); | |
21 ta.setSelectionRange(5, 10); | |
22 log('After setSelectionRange(5, 10): textarea selection start: ' + ta.se
lectionStart + ' end: ' + ta.selectionEnd + '<br>'); | |
23 | |
24 log('Double clicking to make selection for textarea'); | |
25 if (window.eventSender) { | |
26 eventSender.mouseMoveTo(75, 55); | |
27 eventSender.mouseDown(); | |
28 eventSender.mouseUp(); | |
29 eventSender.mouseDown(); | |
30 eventSender.mouseUp(); | |
31 } | |
32 log('After double clicking: textarea selection start: ' + ta.selectionSt
art + ' end: ' + ta.selectionEnd + '<br>'); | |
33 | |
34 log('Calling blur on textarea'); | |
35 ta.blur(); | |
36 log('After blur: textarea selection start: ' + ta.selectionStart + ' end
: ' + ta.selectionEnd + '<br>'); | |
37 | |
38 log('Calling focus on textarea'); | |
39 ta.focus(); | |
40 log('After focus: textarea selection start: ' + ta.selectionStart + ' en
d: ' + ta.selectionEnd); | |
41 } | |
42 </script> | |
43 </head> | |
44 <body onload="test()"> | |
45 <br> | |
46 This tests onSelect for textareas. <br> | |
47 This also makes sure that the correct selection is restored when the element reg
ains focus.<br><br> | |
48 <textarea id="ta" onselect="log('onselect fired for textarea');" style="position
: absolute; top: 50; left: 10;">textarea with lots of fun content!</textarea> | |
49 <div id="res" style="position: absolute; top: 100; left: 10;"></div> | |
50 </body> | |
51 </html> | |
52 | |
OLD | NEW |