Added basic keypress events #1

merged 3 commits into from Sep 7, 2012


None yet
2 participants

doodlemoonch commented May 17, 2012

Added basic keypress events that uses initKeyboardEvent for browsers that support it and initKeyEvent for Gecko/Firefox.


tmcw commented May 17, 2012

Hey, a few things here - the various arguments to this function (keyCode, shiftkey, metakey, charCode) are hardcoded to null or 72, and probably should be customizable. The target is also hardcoded to null, so a dumb test like

<!DOCTYPE html>
    <button id='b'>b</button>
    <script src='src/happen.js'>
      window.onkeydown = function() {
      document.getElementById('b').onclick = function() {

doesn't show any result. That and I'm not sure whether this level of abstraction for initKey event will work, though I haven't gotten tests running: won't interpolate .property - perhaps you're looking for something like

initEvent = 'initKeyEvent';

Otherwise looks great and would be a great addition to the library!

@tmcw tmcw merged commit 183c257 into tmcw:master Sep 7, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment