Skip to content

Commit

Permalink
Added flag to control enable / disable of direct element binding #51.
Browse files Browse the repository at this point in the history
  • Loading branch information
rpocklin committed Jan 13, 2015
1 parent a4cdf9f commit 8be4462
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion jquery.hotkeys.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@
textInputTypes: /textarea|input|select/i,

options: {
filterInputAcceptingElements: true,
filterTextInputs: true,
filterContentEditable: true
}
Expand All @@ -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))) {
Expand Down

0 comments on commit 8be4462

Please sign in to comment.