Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: lib/keySelector.js

Issue 5462707926990848: Issue 1434 - Removed remaining non-standard JavaScript code from buildtools (Closed)
Patch Set: Rebased Created May 6, 2015, 11 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/hooks.js ('k') | lib/prefs.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/keySelector.js
===================================================================
--- a/lib/keySelector.js
+++ b/lib/keySelector.js
@@ -4,16 +4,13 @@
Cu.import("resource://gre/modules/Services.jsm");
-let validModifiers =
-{
- ACCEL: null,
- CTRL: "control",
- CONTROL: "control",
- SHIFT: "shift",
- ALT: "alt",
- META: "meta",
- __proto__: null
-};
+let validModifiers = Object.create(null);
+validModifiers.ACCEL = null;
+validModifiers.CTRL = "control";
+validModifiers.CONTROL = "control";
+validModifiers.SHIFT = "shift";
+validModifiers.ALT = "alt";
+validModifiers.META = "meta";
/**
* Sets the correct value of validModifiers.ACCEL.
@@ -66,7 +63,7 @@
if (!validModifiers.ACCEL)
initAccelKey();
- this._existingShortcuts = {__proto__: null};
+ this._existingShortcuts = Object.create(null);
let keys = window.document.getElementsByTagName("key");
for (let i = 0; i < keys.length; i++)
@@ -95,7 +92,7 @@
let keyModifiers = key.getAttribute("modifiers");
if (keyModifiers)
- for each (let modifier in keyModifiers.toUpperCase().match(/\w+/g))
+ for (let modifier of keyModifiers.toUpperCase().match(/\w+/g))
if (modifier in validModifiers)
keyData[validModifiers[modifier]] = true;
@@ -110,7 +107,7 @@
*/
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;
@@ -125,7 +122,7 @@
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;
« no previous file with comments | « lib/hooks.js ('k') | lib/prefs.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld