blob: 466b64f64eef29cac5d4f22746c3ae726a26df75 [file] [log] [blame]
<p>To test manually, press keys and compare results to other browsers.</p>
<input type="button" value="Input"
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>
<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;
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.keyIdentifier
+ ' - ' + event.keyCode
+ ' - ' + event.charCode;
else if (event.type == "mousedown" || event.type == "click" || event.type == "mouseup")
return (where ? "(" + where + ") " : "") + target.tagName + " - " + event.type;
} catch (ex) {
alert(ex);
}
}
log("target - type - " + ["ctrlKey", "altKey", "shiftKey", "metaKey"]
+ ' - ' + "keyIdentifier"
+ ' - ' + "keyCode"
+ ' - ' + "charCode");
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.layoutTestController) {
layoutTestController.dumpAsText();
log("Space:");
eventSender.keyDown(" ", []);
log("Enter:");
eventSender.keyDown("\r", []);
log("A:");
eventSender.keyDown("A", []);
}
</script>