48 lines
1.8 KiB
HTML
48 lines
1.8 KiB
HTML
<html>
|
|
<head>
|
|
<script>
|
|
function log(msg) {
|
|
document.getElementById('res').innerHTML = document.getElementById('res').innerHTML + msg + "<br>";
|
|
}
|
|
|
|
function test() {
|
|
if (window.testRunner)
|
|
testRunner.dumpAsText();
|
|
var tf = document.getElementById('tf');
|
|
|
|
log('Calling focus on text field');
|
|
tf.focus();
|
|
log('After focus: text field selection start: ' + tf.selectionStart + ' end: ' + tf.selectionEnd + '<br>');
|
|
|
|
log('Calling setSelectionRange on text field');
|
|
tf.setSelectionRange(3, 5);
|
|
log('After setSelectionRange(3, 5): text field selection start: ' + tf.selectionStart + ' end: ' + tf.selectionEnd + '<br>');
|
|
|
|
log('Double clicking to make selection for text field');
|
|
if (window.eventSender) {
|
|
eventSender.mouseMoveTo(60, 55);
|
|
eventSender.mouseDown();
|
|
eventSender.mouseUp();
|
|
eventSender.mouseDown();
|
|
eventSender.mouseUp();
|
|
}
|
|
log('After double clicking: text field selection start: ' + tf.selectionStart + ' end: ' + tf.selectionEnd + '<br>');
|
|
|
|
log('Calling blur on text field');
|
|
tf.blur();
|
|
log('After blur: text field selection start: ' + tf.selectionStart + ' end: ' + tf.selectionEnd + '<br>');
|
|
|
|
log('Calling focus on text field');
|
|
tf.focus();
|
|
log('After focus: text field selection start: ' + tf.selectionStart + ' end: ' + tf.selectionEnd);
|
|
}
|
|
</script>
|
|
</head>
|
|
<body onload="test()"><br>
|
|
This tests onSelect for text fields. <br><br>
|
|
<input type="text" id="tf" onselect="log('onselect fired for text field');" style="position: absolute; top: 50; left: 10;" value="input text"></input>
|
|
<div id="res" style="position: absolute; top: 100; left: 10;"></div>
|
|
</body>
|
|
</html>
|
|
|