From 195eff59118caff3c570f7f06fbb11b25d0c5f90 Mon Sep 17 00:00:00 2001 From: Andrew Bonventre Date: Sun, 24 Jan 2016 23:16:39 -0500 Subject: [PATCH] Fill in getModifierState when it's not defined CustomEvent fired by the testing framework does not define a getModifierState function on the event. Change-Id: Ie490d2505780f241661e2dde36128f4e120cc89f --- polygerrit-ui/app/scripts/util.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/polygerrit-ui/app/scripts/util.js b/polygerrit-ui/app/scripts/util.js index bb0d75af95..8269612890 100644 --- a/polygerrit-ui/app/scripts/util.js +++ b/polygerrit-ui/app/scripts/util.js @@ -40,11 +40,14 @@ util.escapeHTML = function(str) { }; util.shouldSupressKeyboardShortcut = function(e) { + var getModifierState = e.getModifierState ? + e.getModifierState.bind(e) : + function() { return false; }; var target = e.detail ? e.detail.keyboardEvent : e.target; - return e.getModifierState('Control') || - e.getModifierState('Alt') || - e.getModifierState('Meta') || - e.getModifierState('Fn') || + return getModifierState('Control') || + getModifierState('Alt') || + getModifierState('Meta') || + getModifierState('Fn') || target.tagName == 'INPUT' || target.tagName == 'TEXTAREA' || target.tagName == 'SELECT' ||