From 8be446274e9321e65361058669a4a302ea254c3d Mon Sep 17 00:00:00 2001 From: Robert Pocklington Date: Tue, 13 Jan 2015 23:08:27 +1100 Subject: [PATCH] Added flag to control enable / disable of direct element binding #51. --- jquery.hotkeys.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/jquery.hotkeys.js b/jquery.hotkeys.js index 51f1a39..936fde3 100644 --- a/jquery.hotkeys.js +++ b/jquery.hotkeys.js @@ -121,6 +121,7 @@ textInputTypes: /textarea|input|select/i, options: { + filterInputAcceptingElements: true, filterTextInputs: true, filterContentEditable: true } @@ -143,7 +144,9 @@ handleObj.handler = function(event) { // Don't fire in text-accepting inputs that we didn't directly bind to - if (this !== event.target && (jQuery.hotkeys.textInputTypes.test(event.target.nodeName) || + if (this !== event.target && + (jQuery.hotkeys.options.filterInputAcceptingElements && + jQuery.hotkeys.textInputTypes.test(event.target.nodeName) || (jQuery.hotkeys.options.filterContentEditable && jQuery(event.target).attr('contenteditable')) || (jQuery.hotkeys.options.filterTextInputs && jQuery.inArray(event.target.type, jQuery.hotkeys.textAcceptingInputTypes) > -1))) {