Index: lib/keySelector.js |
=================================================================== |
--- a/lib/keySelector.js |
+++ b/lib/keySelector.js |
@@ -89,48 +89,54 @@ KeySelector.prototype = |
let keyCode = key.getAttribute("keycode"); |
if (keyCode && "DOM_" + keyCode.toUpperCase() in Ci.nsIDOMKeyEvent) |
keyData.code = Ci.nsIDOMKeyEvent["DOM_" + keyCode.toUpperCase()]; |
if (!keyData.char && !keyData.code) |
continue; |
let keyModifiers = key.getAttribute("modifiers"); |
- if (keyModifiers) |
- for each (let modifier in keyModifiers.toUpperCase().match(/\w+/g)) |
+ let modifiers = keyModifiers ? keyModifiers.toUpperCase().match(/\w+/g) : null; |
Wladimir Palant
2014/12/09 21:24:49
Comment from previous round not addressed or repli
|
+ if (modifiers) |
+ { |
+ for (let modifier of modifiers) |
+ { |
if (modifier in validModifiers) |
keyData[validModifiers[modifier]] = true; |
+ } |
+ } |
let canonical = [keyData.shift, keyData.meta, keyData.alt, keyData.control, keyData.char || keyData.code].join(" "); |
this._existingShortcuts[canonical] = true; |
} |
}, |
/** |
* Selects a keyboard shortcut variant that isn't already taken, |
* parses it into an object. |
*/ |
selectKey: function(/**String*/ variants) /**Object*/ |
{ |
- for each (let variant in variants.split(/\s*,\s*/)) |
+ for (let variant of variants.split(/\s*,\s*/)) |
{ |
if (!variant) |
continue; |
let keyData = |
{ |
shift: false, |
meta: false, |
alt: false, |
control: false, |
char: null, |
code: null, |
codeName: null |
}; |
- for each (let part in variant.toUpperCase().split(/\s+/)) |
+ |
+ for (let part of variant.toUpperCase().split(/\s+/)) |
{ |
if (part in validModifiers) |
keyData[validModifiers[part]] = true; |
else if (part.length == 1) |
keyData.char = part; |
else if ("DOM_VK_" + part in Ci.nsIDOMKeyEvent) |
{ |
keyData.code = Ci.nsIDOMKeyEvent["DOM_VK_" + part]; |