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
This commit is contained in:
Andrew Bonventre
2016-01-24 23:16:39 -05:00
parent 570190c16d
commit 195eff5911

View File

@@ -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' ||