Skip to content

Commit 35155c8

Browse files
committed
Updating keymasher
1 parent 1848ea0 commit 35155c8

File tree

1 file changed

+11
-17
lines changed

1 file changed

+11
-17
lines changed

spec/lib/jquery.keymasher.js

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,7 @@
3333
forced[modifier]=isForced;
3434
modifierState[modifier]=(direction=='down');
3535
var event=$.extend($.Event(), modifierState, {type:'key'+direction, keyCode: keys[modifier].keyCode, charCode: 0});
36-
elm.queue('keymash',function(){
37-
elm.trigger(event);
38-
$(this).dequeue('keymash');
39-
});
36+
elm.trigger(event);
4037
};
4138

4239
var queueStroke=function(key){
@@ -50,20 +47,17 @@
5047
var ignore = !key.charCode || modifierState.alt || modifierState.ctrl || modifierState.meta,
5148
down = $.extend($.Event('keydown'), modifierState, {keyCode: key.keyCode, charCode: 0}),
5249
press = $.extend($.Event('keypress'), modifierState, {keyCode: key.charCode, charCode: key.charCode}),
53-
up = $.extend($.Event('keyup'), modifierState, {keyCode: key.keyCode, charCode: 0});
50+
up = $.extend($.Event('keyup'), modifierState, {keyCode: key.keyCode, charCode: 0});
5451

55-
elm.queue('keymash',function(){
56-
elm.trigger(down);
57-
if(!down.isPropagationStopped() && !ignore){
58-
elm.trigger(press);
59-
if(!press.isPropagationStopped()){
60-
//need to do caret positioning
61-
elm.val(elm.val()+String.fromCharCode(key.charCode));
62-
}
52+
elm.trigger(down);
53+
if(!down.isPropagationStopped() && !ignore){
54+
elm.trigger(press);
55+
if(!press.isPropagationStopped()){
56+
//need to do caret positioning
57+
elm.val(elm.val()+String.fromCharCode(key.charCode));
6358
}
64-
elm.trigger(up);
65-
$(this).dequeue('keymash');
66-
});
59+
}
60+
elm.trigger(up);
6761

6862
if(forced.shift)
6963
queueModifierEvent('up','shift');
@@ -97,6 +91,6 @@
9791
}
9892
return this.each(function(){
9993
fn(KeyMasher($(this)));
100-
}).dequeue("keymash");
94+
});
10195
};
10296
})(jQuery);

0 commit comments

Comments
 (0)