From a9aba3945bca4c00b9b3e1cc91cc623c76e002b3 Mon Sep 17 00:00:00 2001 From: smaury Date: Fri, 19 Feb 2016 12:40:45 +0100 Subject: [PATCH] Fix incorrect focus on 'persistent': true If persistent is set to true this code is executed: 497 - self._processKey('', false); Then at the end of Formatter.prototype._processKey this code is executed with ignoreCaret not set so it's Undefined: 647 - this._formattValue(ignoreCaret); Finally this code who changes screen position, if ignoreCaret is False or Undefined, is executed: 694 - inptSel.set(this.el,this.newPos); So it's enough to change line 497 to self._processKey('', false, true); to fix this. --- dist/jquery.formatter.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dist/jquery.formatter.js b/dist/jquery.formatter.js index 7909731..b6c1bcd 100644 --- a/dist/jquery.formatter.js +++ b/dist/jquery.formatter.js @@ -494,7 +494,7 @@ var formatter = function (patternMatcher, inptSel, utils) { // Persistence if (self.opts.persistent) { // Format on start - self._processKey('', false); + self._processKey('', false, true); self.el.blur(); // Add Listeners utils.addListener(self.el, 'focus', function (evt) { @@ -858,4 +858,4 @@ $.fn[pluginName].addInptType = function (chr, regexp) { }; -})); \ No newline at end of file +}));