Skip to content

Instantly share code, notes, and snippets.

@timdream
Created May 28, 2012 03:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timdream/2817145 to your computer and use it in GitHub Desktop.
Save timdream/2817145 to your computer and use it in GitHub Desktop.
Key event test
<!DOCTYPE html>
<html manifest="manifest.appcache">
<body>
Tap on the black space to test key events bubbling from mozbrowser.
Tap on the red space to test key events bubbling from mozbrowser within mozbrowser.
<iframe width=400 height=600 mozbrowser src="data:text/html,<body bgcolor=black>&lt;iframe mozbrowser src='data:text/html,<body bgcolor=red>'>&lt;/iframe></body>"></iframe>
<script>
['keydown', 'keypress', 'keyup'].forEach(function (type) {
window.addEventListener(type, function (evt) {
dump('==== ' + evt.type + ', ' + evt.keyCode + ', ' + evt.eventPhase + ', ' + evt.target);
}, false, true);
window.addEventListener(type, function (evt) {
dump('==== ' + evt.type + ', ' + evt.keyCode + ', ' + evt.eventPhase + ', ' + evt.target);
}, true, true);
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment