jaridmargolin / formatter.js

Format html inputs to match a specified pattern
http://firstopinion.github.io/formatter.js
2.48k stars 235 forks source link

Fix incorrect focus on 'persistent': true #94

Open smaury opened 8 years ago

smaury commented 8 years ago

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.

hsyntnc commented 6 years ago

You rock bro!