blob: 72835433e42452af2b0306550eae0bf7c94d9d5b [file] [log] [blame]
<p>To test manually, press keys and compare results to other browsers.</p>
<input type="text"
onclick="log(eventInfo(event));"
onmousedown="log(eventInfo(event));"
onmouseup="log(eventInfo(event));"
onkeypress="log(eventInfo(event));"
onkeydown="log(eventInfo(event));"
onkeyup="log(eventInfo(event));">
</input>
<input type=text></input>
<div id="log"></div>
<script>
function log(msg) {
document.getElementById("log").innerHTML+= msg + "<br />";
}
function eventInfo(event, where) {
try {
if (!event)
event = window.event;
target = event.srcElement ? event.srcElement : event.target;
if (event.type == "textInput")
return (where ? "(" + where + ") " : "") + target.tagName + " - " + event.type + " - " + event.data
+ '. Value: "' + target.value + '".';
else if (event.type == "keydown" || event.type == "keypress" || event.type == "keyup")
return (where ? "(" + where + ") " : "") + target.tagName + " - " + event.type
+ ' - ' + [event.ctrlKey, event.altKey, event.shiftKey, event.metaKey]
+ ' - ' + event.key
+ ' - ' + event.code
+ ' - ' + event.keyIdentifier
+ ' - ' + event.keyCode
+ ' - ' + event.charCode
+ ' - ' + event.which
+ '. Value: "' + target.value + '".';
else if (event.type == "mousedown" || event.type == "click" || event.type == "mouseup")
return (where ? "(" + where + ") " : "") + target.tagName + " - " + event.type
'. Value: "' + target.value + '".';
} catch (ex) {
alert(ex);
}
}
log("target - type - " + ["ctrlKey", "altKey", "shiftKey", "metaKey"]
+ ' - ' + "key"
+ ' - ' + "code"
+ ' - ' + "keyIdentifier"
+ ' - ' + "keyCode"
+ ' - ' + "charCode"
+ ' - ' + "which");
if (document.getElementsByTagName("input")[0].addEventListener)
document.getElementsByTagName("input")[0].addEventListener('textInput', function(e) {log(eventInfo(e));}, false);
document.getElementsByTagName("input")[0].focus();
if (window.testRunner) {
testRunner.dumpAsText();
log("Space:");
eventSender.keyDown(" ", []);
log("Backspace:");
eventSender.keyDown("\x08", []);
log("Left Arrow:");
eventSender.keyDown("leftArrow", []);
log("Tab:");
eventSender.keyDown("\t", []);
}
</script>