diff options
author | Kris Maglione <maglione.k@gmail.com> | 2011-03-16 18:02:16 -0400 |
---|---|---|
committer | Kris Maglione <maglione.k@gmail.com> | 2011-03-16 18:02:16 -0400 |
commit | 1f6c944488e4b3612955c23b7e29ab205d3df5d6 (patch) | |
tree | d619ec5c535d6e9c21ac807d823d1fa546e22628 /common/content | |
parent | ba4b07a593415abd2a748878687f8ee3c6ceee2e (diff) | |
download | pentadactyl-1f6c944488e4b3612955c23b7e29ab205d3df5d6.tar.gz |
Fix bug in events.toString.
Diffstat (limited to 'common/content')
-rw-r--r-- | common/content/events.js | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/common/content/events.js b/common/content/events.js index 3730b4e2..119cbe9f 100644 --- a/common/content/events.js +++ b/common/content/events.js @@ -849,7 +849,12 @@ var Events = Module("events", { let evt_obj = { ctrlKey: false, shiftKey: false, altKey: false, metaKey: false, keyCode: 0, charCode: 0, type: "keypress" }; - if (evt_str.length > 1) { // <.*?> + if (evt_str.length == 1) { + evt_obj.charCode = evt_str.charCodeAt(0); + evt_obj._keyCode = this._key_code[evt_str[0]]; + evt_obj.shiftKey = evt_str !== evt_str.toLowerCase(); + } + else { let [match, modifier, keyname] = evt_str.match(/^<((?:[*12CASM]-)*)(.+?)>$/i) || [false, '', '']; modifier = set(modifier.toUpperCase()); keyname = keyname.toLowerCase(); @@ -892,10 +897,6 @@ var Events = Module("events", { continue; } } - else {// a simple key (no <...>) - evt_obj.charCode = evt_str.charCodeAt(0); - evt_obj._keyCode = this._key_code[evt_str[0]]; - } // TODO: make a list of characters that need keyCode and charCode somewhere if (evt_obj.keyCode == 32 || evt_obj.charCode == 32) |