From f1bbda4282316c4d345453a405549b224234fbab Mon Sep 17 00:00:00 2001 From: vkurlyan Date: Mon, 12 Feb 2018 18:56:17 +0100 Subject: [PATCH] Prevent exception with browser autocompletion I got an exception with "Google smart lock" in chrome. In single page application, if there is hidden login page where chrome automatically fills user's data. Then keyboard is shown because of autocompletion and we get an exception in $keyboard.caret() function "Cannot read length of null". With this changes keyboard is still opened but at least there is no exception. --- js/jquery.keyboard.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/jquery.keyboard.js b/js/jquery.keyboard.js index 62ebc34b..ebc2fbd1 100644 --- a/js/jquery.keyboard.js +++ b/js/jquery.keyboard.js @@ -3088,7 +3088,7 @@ http://www.opensource.org/licenses/mit-license.php }; $keyboard.caret = function($el, param1, param2) { - if (!$el.length || $el.is(':hidden') || $el.css('visibility') === 'hidden') { + if (!$el || !$el.length || $el.is(':hidden') || $el.css('visibility') === 'hidden') { return {}; } var start, end, txt, pos,