Browse files

set "which" property on events (most examples online check against it)

  • Loading branch information...
1 parent ff23a2b commit d26ee3007f4e3952aac36b9f75d4462246e27ad1 @leeoniya leeoniya committed Jan 28, 2011
Showing with 3 additions and 3 deletions.
  1. +3 −3 jquery.autotype.js
View
6 jquery.autotype.js
@@ -177,9 +177,9 @@
};
// build out 3 event instances for all the steps of a key entry
- var keyDownEvent = $.extend($.Event(), evnt, {type:'keydown', keyCode: code.keyCode, charCode: 0});
- var keyPressEvent = $.extend($.Event(), evnt, {type:'keypress', keyCode: 0, charCode: code.charCode});
- var keyUpEvent = $.extend($.Event(), evnt, {type:'keyup', keyCode: code.keyCode, charCode: 0});
+ var keyDownEvent = $.extend($.Event(), evnt, {type:'keydown', keyCode: code.keyCode, charCode: 0, which: code.keyCode});
+ var keyPressEvent = $.extend($.Event(), evnt, {type:'keypress', keyCode: 0, charCode: code.charCode, which: code.charCode || code.keyCode});
+ var keyUpEvent = $.extend($.Event(), evnt, {type:'keyup', keyCode: code.keyCode, charCode: 0, which: code.keyCode});
// go ahead and trigger the first 2 (down and press)
// a keyup of a modifier shouldn't also re-trigger a keydown

0 comments on commit d26ee30

Please sign in to comment.