diff options
Diffstat (limited to 'ext/mixed/js/display.js')
-rw-r--r-- | ext/mixed/js/display.js | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/ext/mixed/js/display.js b/ext/mixed/js/display.js index 39bd7732..9824c25e 100644 --- a/ext/mixed/js/display.js +++ b/ext/mixed/js/display.js @@ -205,7 +205,7 @@ class Display extends EventDispatcher { const eventModifiers = DocumentUtil.getActiveModifiers(e); for (const {modifiers, action} of handlers) { - if (getSetDifference(modifiers, eventModifiers).size !== 0) { continue; } + if (!this._areSame(modifiers, eventModifiers)) { continue; } const actionHandler = this._actions.get(action); if (typeof actionHandler === 'undefined') { continue; } @@ -1476,4 +1476,14 @@ class Display extends EventDispatcher { const {expression, reading} = termDetailsList[Math.max(0, bestIndex)]; return {expression, reading}; } + + _areSame(set, array) { + if (set.size !== array.size) { return false; } + for (const value of array) { + if (!set.has(value)) { + return false; + } + } + return true; + } } |