aboutsummaryrefslogtreecommitdiff
path: root/ext/mixed/js/document-util.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-11-08 22:19:54 -0500
committerGitHub <noreply@github.com>2020-11-08 22:19:54 -0500
commit8edb478d0adbc7c09e827f1606f9e7a6660dec65 (patch)
treed7776da1117456d94b2ef8861150637eca60143d /ext/mixed/js/document-util.js
parent681065e5549e3f6bf54e416120884481bded5b6e (diff)
Update keyboard/mouse modifiers to return an array rather than a set (#1015)
Diffstat (limited to 'ext/mixed/js/document-util.js')
-rw-r--r--ext/mixed/js/document-util.js17
1 files changed, 8 insertions, 9 deletions
diff --git a/ext/mixed/js/document-util.js b/ext/mixed/js/document-util.js
index 90add8f9..da27a75d 100644
--- a/ext/mixed/js/document-util.js
+++ b/ext/mixed/js/document-util.js
@@ -170,11 +170,11 @@ class DocumentUtil {
}
static getActiveModifiers(event) {
- const modifiers = new Set();
- if (event.altKey) { modifiers.add('alt'); }
- if (event.ctrlKey) { modifiers.add('ctrl'); }
- if (event.metaKey) { modifiers.add('meta'); }
- if (event.shiftKey) { modifiers.add('shift'); }
+ const modifiers = [];
+ if (event.altKey) { modifiers.push('alt'); }
+ if (event.ctrlKey) { modifiers.push('ctrl'); }
+ if (event.metaKey) { modifiers.push('meta'); }
+ if (event.shiftKey) { modifiers.push('shift'); }
return modifiers;
}
@@ -185,7 +185,7 @@ class DocumentUtil {
}
static getActiveButtons(event) {
- const buttons = new Set();
+ const buttons = [];
this._getActiveButtons(event, buttons);
return buttons;
}
@@ -301,19 +301,18 @@ class DocumentUtil {
return !(browser === 'firefox' || browser === 'firefox-mobile') || os === 'mac';
}
- static _getActiveButtons(event, set) {
+ static _getActiveButtons(event, array) {
let {buttons} = event;
if (typeof buttons === 'number' && buttons > 0) {
for (let i = 0; i < 6; ++i) {
const buttonFlag = (1 << i);
if ((buttons & buttonFlag) !== 0) {
- set.add(`mouse${i}`);
+ array.push(`mouse${i}`);
buttons &= ~buttonFlag;
if (buttons === 0) { break; }
}
}
}
- return set;
}
// Private