From cb9c5a49d7f2f79a78fdefaa3a26b0f5135d5e1d Mon Sep 17 00:00:00 2001 From: Rob Garrison Date: Wed, 29 Mar 2017 06:55:10 -0500 Subject: [PATCH] Core: prevent max call stack error. Fixes #542 --- js/jquery.keyboard.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/js/jquery.keyboard.js b/js/jquery.keyboard.js index 316ed718..69579b0b 100644 --- a/js/jquery.keyboard.js +++ b/js/jquery.keyboard.js @@ -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 @@ -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 @@ -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);