Skip to content

Instantly share code, notes, and snippets.

@timdream

timdream/index.html

Created May 28, 2012
Embed
What would you like to do?
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