Skip to content

Commit

Permalink
Core: prevent max call stack error. Fixes #542
Browse files Browse the repository at this point in the history
  • Loading branch information
Mottie committed Mar 29, 2017
1 parent 5e0620c commit cb9c5a4
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions js/jquery.keyboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,13 @@ http://www.opensource.org/licenses/mit-license.php
if (o.closeByClickEvent) {
bindings += 'click ';
}
tmp.bind(bindings.split(' ').join(base.namespace + ' '), base.checkClose);
// debounce bindings... see #542
tmp.bind(bindings.split(' ').join(base.namespace + ' '), function(e) {
clearTimeout(base.timer3);
base.timer3 = setTimeout(function() {
base.checkClose(e);
}, 1);
});

// Display keyboard on focus
base.$el
Expand Down Expand Up @@ -1622,7 +1628,6 @@ http://www.opensource.org/licenses/mit-license.php
.trigger((o.alwaysOpen) ? kbevents.kbInactive : kbevents.kbHidden, [base, base.el])
.blur();


// base is undefined if keyboard was destroyed - fixes #358
if (base) {
// add close event time
Expand All @@ -1632,7 +1637,7 @@ http://www.opensource.org/licenses/mit-license.php
base.removeKeyboard();
// rebind input focus - delayed to fix IE issue #72
base.timer = setTimeout(function () {
if(base){
if (base) {
base.bindFocus();
}
}, 500);
Expand Down

0 comments on commit cb9c5a4

Please sign in to comment.