Permalink
Browse files

Firefox doesn't support event.keyCode

  • Loading branch information...
1 parent b07cb7a commit d5d5aae4a49d94e712a488207600c3637492509f @georgebrock georgebrock committed Dec 17, 2012
Showing with 7 additions and 5 deletions.
  1. +7 −5 js/base.js
View
@@ -45,19 +45,21 @@
// Use keyup for special characters like escape
$(window).keyup(function (e) {
+ var code = e.charCode || e.keyCode;
if (
- e.keyCode === Vimulator.Utils.Keys.BACKSPACE.charCodeAt(0) ||
- e.keyCode === Vimulator.Utils.Keys.ESC.charCodeAt(0)
+ code === Vimulator.Utils.Keys.BACKSPACE.charCodeAt(0) ||
+ code === Vimulator.Utils.Keys.ESC.charCodeAt(0)
) {
- vim.keyPress(e.keyCode);
+ vim.keyPress(code);
return false;
}
});
// Use keypress for general characters
$(window).keypress(function (e) {
- if (e.keyCode >= 32) {
- vim.keyPress(e.keyCode);
+ var code = e.charCode || e.keyCode;
+ if (code >= 32) {
+ vim.keyPress(code);
return false;
}
});

0 comments on commit d5d5aae

Please sign in to comment.