Browse Source

Fast typing text #1872

Robin Herbots 7 years ago
parent
commit
debab14202
47 changed files with 124 additions and 102 deletions
  1. 1 1
      bower.json
  2. 1 1
      component.json
  3. 1 1
      composer.json
  4. 1 1
      dist/inputmask/bindings/inputmask.binding.js
  5. 1 1
      dist/inputmask/dependencyLibs/inputmask.dependencyLib.jqlite.js
  6. 1 1
      dist/inputmask/dependencyLibs/inputmask.dependencyLib.jquery.js
  7. 1 1
      dist/inputmask/dependencyLibs/inputmask.dependencyLib.js
  8. 1 1
      dist/inputmask/global/document.js
  9. 1 1
      dist/inputmask/global/window.js
  10. 1 1
      dist/inputmask/inputmask.date.extensions.js
  11. 1 1
      dist/inputmask/inputmask.extensions.js
  12. 27 9
      dist/inputmask/inputmask.js
  13. 1 1
      dist/inputmask/inputmask.numeric.extensions.js
  14. 1 1
      dist/inputmask/inputmask.phone.extensions.js
  15. 1 1
      dist/inputmask/jquery.inputmask.js
  16. 1 1
      dist/inputmask/phone-codes/phone-be.js
  17. 1 1
      dist/inputmask/phone-codes/phone-ca.js
  18. 1 1
      dist/inputmask/phone-codes/phone-hu.js
  19. 1 1
      dist/inputmask/phone-codes/phone-it.js
  20. 1 1
      dist/inputmask/phone-codes/phone-mx.js
  21. 1 1
      dist/inputmask/phone-codes/phone-nl.js
  22. 1 1
      dist/inputmask/phone-codes/phone-ru.js
  23. 1 1
      dist/inputmask/phone-codes/phone.js
  24. 27 9
      dist/jquery.inputmask.bundle.js
  25. 1 1
      dist/min/inputmask/bindings/inputmask.binding.min.js
  26. 1 1
      dist/min/inputmask/dependencyLibs/inputmask.dependencyLib.jqlite.min.js
  27. 1 1
      dist/min/inputmask/dependencyLibs/inputmask.dependencyLib.jquery.min.js
  28. 1 1
      dist/min/inputmask/dependencyLibs/inputmask.dependencyLib.min.js
  29. 1 1
      dist/min/inputmask/global/document.min.js
  30. 1 1
      dist/min/inputmask/global/window.min.js
  31. 1 1
      dist/min/inputmask/inputmask.date.extensions.min.js
  32. 1 1
      dist/min/inputmask/inputmask.extensions.min.js
  33. 2 2
      dist/min/inputmask/inputmask.min.js
  34. 1 1
      dist/min/inputmask/inputmask.numeric.extensions.min.js
  35. 1 1
      dist/min/inputmask/inputmask.phone.extensions.min.js
  36. 1 1
      dist/min/inputmask/jquery.inputmask.min.js
  37. 1 1
      dist/min/inputmask/phone-codes/phone-be.min.js
  38. 1 1
      dist/min/inputmask/phone-codes/phone-ca.min.js
  39. 1 1
      dist/min/inputmask/phone-codes/phone-hu.min.js
  40. 1 1
      dist/min/inputmask/phone-codes/phone-it.min.js
  41. 1 1
      dist/min/inputmask/phone-codes/phone-mx.min.js
  42. 1 1
      dist/min/inputmask/phone-codes/phone-nl.min.js
  43. 1 1
      dist/min/inputmask/phone-codes/phone-ru.min.js
  44. 1 1
      dist/min/inputmask/phone-codes/phone.min.js
  45. 2 2
      dist/min/jquery.inputmask.bundle.min.js
  46. 24 38
      js/inputmask.js
  47. 1 1
      package.json

+ 1 - 1
bower.json

@@ -1,6 +1,6 @@
 {
   "name": "inputmask",
-  "version": "4.0.0-beta.52",
+  "version": "4.0.0-beta.54",
   "main": [
 	  "./index.js",
     "./css/inputmask.css"

+ 1 - 1
component.json

@@ -2,7 +2,7 @@
 	"name": "inputmask",
 	"repository": "robinherbots/Inputmask",
 	"description": "Inputmask is a javascript library which creates an input mask.  Inputmask can run against vanilla javascript, jQuery and jqlite.",
-	"version": "4.0.0-beta.52",
+	"version": "4.0.0-beta.54",
 	"keywords": [
 		"jquery",
 		"plugins",

+ 1 - 1
composer.json

@@ -1,7 +1,7 @@
 {
   "name": "robinherbots/inputmask",
   "description": "Inputmask is a javascript library which creates an input mask.  Inputmask can run against vanilla javascript, jQuery and jqlite.",
-  "version": "4.0.0-beta.52",
+  "version": "4.0.0-beta.54",
   "type": "library",
   "keywords": ["jquery", "plugins", "input", "form", "inputmask", "mask"],
   "homepage": "http://robinherbots.github.io/Inputmask",

+ 1 - 1
dist/inputmask/bindings/inputmask.binding.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.0-beta.52
+* Version: 4.0.0-beta.54
 */
 
 !function(factory) {

+ 1 - 1
dist/inputmask/dependencyLibs/inputmask.dependencyLib.jqlite.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.0-beta.52
+* Version: 4.0.0-beta.54
 */
 
 !function(factory) {

+ 1 - 1
dist/inputmask/dependencyLibs/inputmask.dependencyLib.jquery.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.0-beta.52
+* Version: 4.0.0-beta.54
 */
 
 !function(factory) {

+ 1 - 1
dist/inputmask/dependencyLibs/inputmask.dependencyLib.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.0-beta.52
+* Version: 4.0.0-beta.54
 */
 
 !function(factory) {

+ 1 - 1
dist/inputmask/global/document.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.0-beta.52
+* Version: 4.0.0-beta.54
 */
 
 "function" == typeof define && define.amd ? define(function() {

+ 1 - 1
dist/inputmask/global/window.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.0-beta.52
+* Version: 4.0.0-beta.54
 */
 
 "function" == typeof define && define.amd ? define(function() {

+ 1 - 1
dist/inputmask/inputmask.date.extensions.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.0-beta.52
+* Version: 4.0.0-beta.54
 */
 
 !function(factory) {

+ 1 - 1
dist/inputmask/inputmask.extensions.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.0-beta.52
+* Version: 4.0.0-beta.54
 */
 
 !function(factory) {

+ 27 - 9
dist/inputmask/inputmask.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.0-beta.52
+* Version: 4.0.0-beta.54
 */
 
 !function(factory) {
@@ -74,13 +74,13 @@
     }
     function maskScope(actionObj, maskset, opts) {
         maskset = maskset || this.maskset, opts = opts || this.opts;
-        var undoValue, $el, maxLength, colorMask, inputmask = this, el = this.el, isRTL = this.isRTL, skipKeyPressEvent = !1, skipInputEvent = !1, ignorable = !1, mouseEnter = !1, trackCaret = !1;
+        var undoValue, $el, maxLength, colorMask, inputmask = this, el = this.el, isRTL = this.isRTL, skipKeyPressEvent = !1, skipInputEvent = !1, ignorable = !1, mouseEnter = !1;
         function getMaskTemplate(baseOnInput, minimalPos, includeMode, noJit, clearOptionalTail) {
             var greedy = opts.greedy;
             clearOptionalTail && (opts.greedy = !1), minimalPos = minimalPos || 0;
             var ndxIntlzr, test, testPos, maskTemplate = [], pos = 0, lvp = getLastValidPosition();
             do {
-                if (!0 === baseOnInput && getMaskSet().validPositions[pos]) test = (testPos = !clearOptionalTail || !0 !== getMaskSet().validPositions[pos].match.optionality || !0 !== getMaskSet().validPositions[pos].generatedInput && getMaskSet().validPositions[pos].input != opts.skipOptionalPartCharacter || getMaskSet().validPositions[pos + 1] !== undefined ? getMaskSet().validPositions[pos] : determineTestTemplate(pos, getTests(pos, ndxIntlzr, pos - 1))).match, 
+                if (!0 === baseOnInput && getMaskSet().validPositions[pos]) test = (testPos = clearOptionalTail && !0 === getMaskSet().validPositions[pos].match.optionality && getMaskSet().validPositions[pos + 1] === undefined && (!0 === getMaskSet().validPositions[pos].generatedInput || getMaskSet().validPositions[pos].input == opts.skipOptionalPartCharacter && pos > 0) ? determineTestTemplate(pos, getTests(pos, ndxIntlzr, pos - 1)) : getMaskSet().validPositions[pos]).match, 
                 ndxIntlzr = testPos.locator.slice(), maskTemplate.push(!0 === includeMode ? testPos.input : !1 === includeMode ? test.nativeDef : getPlaceholder(pos, test)); else {
                     test = (testPos = getTestTemplate(pos, ndxIntlzr, pos - 1)).match, ndxIntlzr = testPos.locator.slice();
                     var jitMasking = !0 !== noJit && (!1 !== opts.jitMasking ? opts.jitMasking : test.jit);
@@ -596,10 +596,9 @@
                               case "input":
                                 if (!0 === skipInputEvent) return skipInputEvent = !1, e.preventDefault();
                                 if (mobile) {
-                                    trackCaret = !0;
                                     var args = arguments;
                                     return setTimeout(function() {
-                                        eventHandler.apply(that, args);
+                                        eventHandler.apply(that, args), caret(that, that.inputmask.caretPos, undefined, !0);
                                     }, 0), !1;
                                 }
                                 break;
@@ -622,9 +621,7 @@
                                 }
                             }
                             var returnVal = eventHandler.apply(that, arguments);
-                            return trackCaret && (trackCaret = !1, setTimeout(function() {
-                                caret(that, that.inputmask.caretPos, undefined, !0);
-                            })), !1 === returnVal && (e.preventDefault(), e.stopPropagation()), returnVal;
+                            return !1 === returnVal && (e.preventDefault(), e.stopPropagation()), returnVal;
                         }
                         e.preventDefault();
                     }
@@ -758,6 +755,27 @@
                     }
                 }
             },
+            beforeInputEvent: function(e) {
+                if (e.cancelable) {
+                    var input = this;
+                    switch (e.inputType) {
+                      case "insertText":
+                        return $.each(e.data.split(""), function(ndx, entry) {
+                            var keypress = new $.Event("keypress");
+                            keypress.which = entry.charCodeAt(0), ignorable = !1, EventHandlers.keypressEvent.call(input, keypress);
+                        }), e.preventDefault();
+
+                      case "deleteContentBackward":
+                        return (keydown = new $.Event("keydown")).keyCode = Inputmask.keyCode.BACKSPACE, 
+                        EventHandlers.keydownEvent.call(input, keydown), e.preventDefault();
+
+                      case "deleteContentForward":
+                        var keydown;
+                        return (keydown = new $.Event("keydown")).keyCode = Inputmask.keyCode.DELETE, EventHandlers.keydownEvent.call(input, keydown), 
+                        e.preventDefault();
+                    }
+                }
+            },
             setValueEvent: function(e) {
                 this.inputmask.refreshValue = !1;
                 var value = (value = e && e.detail ? e.detail[0] : arguments[1]) || this.inputmask._valueGet(!0);
@@ -1180,7 +1198,7 @@
                 EventRuler.on(el, "keypress", EventHandlers.keypressEvent)), EventRuler.on(el, "compositionstart", $.noop), 
                 EventRuler.on(el, "compositionupdate", $.noop), EventRuler.on(el, "compositionend", $.noop), 
                 EventRuler.on(el, "keyup", $.noop), EventRuler.on(el, "input", EventHandlers.inputFallBackEvent), 
-                EventRuler.on(el, "beforeinput", $.noop)), EventRuler.on(el, "setvalue", EventHandlers.setValueEvent), 
+                EventRuler.on(el, "beforeinput", EventHandlers.beforeInputEvent)), EventRuler.on(el, "setvalue", EventHandlers.setValueEvent), 
                 undoValue = getBufferTemplate().join(""), "" !== el.inputmask._valueGet(!0) || !1 === opts.clearMaskOnLostFocus || document.activeElement === el)) {
                     var initialValue = $.isFunction(opts.onBeforeMask) && opts.onBeforeMask.call(inputmask, el.inputmask._valueGet(!0), opts) || el.inputmask._valueGet(!0);
                     "" !== initialValue && checkVal(el, !0, !1, isRTL ? initialValue.split("").reverse() : initialValue.split(""));

+ 1 - 1
dist/inputmask/inputmask.numeric.extensions.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.0-beta.52
+* Version: 4.0.0-beta.54
 */
 
 !function(factory) {

+ 1 - 1
dist/inputmask/inputmask.phone.extensions.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.0-beta.52
+* Version: 4.0.0-beta.54
 */
 
 !function(factory) {

+ 1 - 1
dist/inputmask/jquery.inputmask.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.0-beta.52
+* Version: 4.0.0-beta.54
 */
 
 !function(factory) {

+ 1 - 1
dist/inputmask/phone-codes/phone-be.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.0-beta.52
+* Version: 4.0.0-beta.54
 */
 
 !function(factory) {

+ 1 - 1
dist/inputmask/phone-codes/phone-ca.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.0-beta.52
+* Version: 4.0.0-beta.54
 */
 
 !function(factory) {

+ 1 - 1
dist/inputmask/phone-codes/phone-hu.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.0-beta.52
+* Version: 4.0.0-beta.54
 */
 
 !function(factory) {

+ 1 - 1
dist/inputmask/phone-codes/phone-it.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.0-beta.52
+* Version: 4.0.0-beta.54
 */
 
 !function(factory) {

+ 1 - 1
dist/inputmask/phone-codes/phone-mx.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.0-beta.52
+* Version: 4.0.0-beta.54
 */
 
 !function(factory) {

+ 1 - 1
dist/inputmask/phone-codes/phone-nl.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.0-beta.52
+* Version: 4.0.0-beta.54
 */
 
 !function(factory) {

+ 1 - 1
dist/inputmask/phone-codes/phone-ru.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.0-beta.52
+* Version: 4.0.0-beta.54
 */
 
 !function(factory) {

+ 1 - 1
dist/inputmask/phone-codes/phone.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.0-beta.52
+* Version: 4.0.0-beta.54
 */
 
 !function(factory) {

+ 27 - 9
dist/jquery.inputmask.bundle.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.0-beta.52
+* Version: 4.0.0-beta.54
 */
 
 !function(modules) {
@@ -114,13 +114,13 @@
         }
         function maskScope(actionObj, maskset, opts) {
             maskset = maskset || this.maskset, opts = opts || this.opts;
-            var undoValue, $el, maxLength, colorMask, inputmask = this, el = this.el, isRTL = this.isRTL, skipKeyPressEvent = !1, skipInputEvent = !1, ignorable = !1, mouseEnter = !1, trackCaret = !1;
+            var undoValue, $el, maxLength, colorMask, inputmask = this, el = this.el, isRTL = this.isRTL, skipKeyPressEvent = !1, skipInputEvent = !1, ignorable = !1, mouseEnter = !1;
             function getMaskTemplate(baseOnInput, minimalPos, includeMode, noJit, clearOptionalTail) {
                 var greedy = opts.greedy;
                 clearOptionalTail && (opts.greedy = !1), minimalPos = minimalPos || 0;
                 var ndxIntlzr, test, testPos, maskTemplate = [], pos = 0, lvp = getLastValidPosition();
                 do {
-                    if (!0 === baseOnInput && getMaskSet().validPositions[pos]) test = (testPos = !clearOptionalTail || !0 !== getMaskSet().validPositions[pos].match.optionality || !0 !== getMaskSet().validPositions[pos].generatedInput && getMaskSet().validPositions[pos].input != opts.skipOptionalPartCharacter || getMaskSet().validPositions[pos + 1] !== undefined ? getMaskSet().validPositions[pos] : determineTestTemplate(pos, getTests(pos, ndxIntlzr, pos - 1))).match, 
+                    if (!0 === baseOnInput && getMaskSet().validPositions[pos]) test = (testPos = clearOptionalTail && !0 === getMaskSet().validPositions[pos].match.optionality && getMaskSet().validPositions[pos + 1] === undefined && (!0 === getMaskSet().validPositions[pos].generatedInput || getMaskSet().validPositions[pos].input == opts.skipOptionalPartCharacter && pos > 0) ? determineTestTemplate(pos, getTests(pos, ndxIntlzr, pos - 1)) : getMaskSet().validPositions[pos]).match, 
                     ndxIntlzr = testPos.locator.slice(), maskTemplate.push(!0 === includeMode ? testPos.input : !1 === includeMode ? test.nativeDef : getPlaceholder(pos, test)); else {
                         test = (testPos = getTestTemplate(pos, ndxIntlzr, pos - 1)).match, ndxIntlzr = testPos.locator.slice();
                         var jitMasking = !0 !== noJit && (!1 !== opts.jitMasking ? opts.jitMasking : test.jit);
@@ -636,10 +636,9 @@
                                   case "input":
                                     if (!0 === skipInputEvent) return skipInputEvent = !1, e.preventDefault();
                                     if (mobile) {
-                                        trackCaret = !0;
                                         var args = arguments;
                                         return setTimeout(function() {
-                                            eventHandler.apply(that, args);
+                                            eventHandler.apply(that, args), caret(that, that.inputmask.caretPos, undefined, !0);
                                         }, 0), !1;
                                     }
                                     break;
@@ -662,9 +661,7 @@
                                     }
                                 }
                                 var returnVal = eventHandler.apply(that, arguments);
-                                return trackCaret && (trackCaret = !1, setTimeout(function() {
-                                    caret(that, that.inputmask.caretPos, undefined, !0);
-                                })), !1 === returnVal && (e.preventDefault(), e.stopPropagation()), returnVal;
+                                return !1 === returnVal && (e.preventDefault(), e.stopPropagation()), returnVal;
                             }
                             e.preventDefault();
                         }
@@ -798,6 +795,27 @@
                         }
                     }
                 },
+                beforeInputEvent: function(e) {
+                    if (e.cancelable) {
+                        var input = this;
+                        switch (e.inputType) {
+                          case "insertText":
+                            return $.each(e.data.split(""), function(ndx, entry) {
+                                var keypress = new $.Event("keypress");
+                                keypress.which = entry.charCodeAt(0), ignorable = !1, EventHandlers.keypressEvent.call(input, keypress);
+                            }), e.preventDefault();
+
+                          case "deleteContentBackward":
+                            return (keydown = new $.Event("keydown")).keyCode = Inputmask.keyCode.BACKSPACE, 
+                            EventHandlers.keydownEvent.call(input, keydown), e.preventDefault();
+
+                          case "deleteContentForward":
+                            var keydown;
+                            return (keydown = new $.Event("keydown")).keyCode = Inputmask.keyCode.DELETE, EventHandlers.keydownEvent.call(input, keydown), 
+                            e.preventDefault();
+                        }
+                    }
+                },
                 setValueEvent: function(e) {
                     this.inputmask.refreshValue = !1;
                     var value = (value = e && e.detail ? e.detail[0] : arguments[1]) || this.inputmask._valueGet(!0);
@@ -1220,7 +1238,7 @@
                     EventRuler.on(el, "keypress", EventHandlers.keypressEvent)), EventRuler.on(el, "compositionstart", $.noop), 
                     EventRuler.on(el, "compositionupdate", $.noop), EventRuler.on(el, "compositionend", $.noop), 
                     EventRuler.on(el, "keyup", $.noop), EventRuler.on(el, "input", EventHandlers.inputFallBackEvent), 
-                    EventRuler.on(el, "beforeinput", $.noop)), EventRuler.on(el, "setvalue", EventHandlers.setValueEvent), 
+                    EventRuler.on(el, "beforeinput", EventHandlers.beforeInputEvent)), EventRuler.on(el, "setvalue", EventHandlers.setValueEvent), 
                     undoValue = getBufferTemplate().join(""), "" !== el.inputmask._valueGet(!0) || !1 === opts.clearMaskOnLostFocus || document.activeElement === el)) {
                         var initialValue = $.isFunction(opts.onBeforeMask) && opts.onBeforeMask.call(inputmask, el.inputmask._valueGet(!0), opts) || el.inputmask._valueGet(!0);
                         "" !== initialValue && checkVal(el, !0, !1, isRTL ? initialValue.split("").reverse() : initialValue.split(""));

File diff suppressed because it is too large
+ 1 - 1
dist/min/inputmask/bindings/inputmask.binding.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/min/inputmask/dependencyLibs/inputmask.dependencyLib.jqlite.min.js


+ 1 - 1
dist/min/inputmask/dependencyLibs/inputmask.dependencyLib.jquery.min.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.0-beta.52
+* Version: 4.0.0-beta.54
 */
 
 !function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?module.exports=e(require("jquery")):window.dependencyLib=e(jQuery)}(function(e){return e});

File diff suppressed because it is too large
+ 1 - 1
dist/min/inputmask/dependencyLibs/inputmask.dependencyLib.min.js


+ 1 - 1
dist/min/inputmask/global/document.min.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.0-beta.52
+* Version: 4.0.0-beta.54
 */
 
 "function"==typeof define&&define.amd?define(function(){return document}):"object"==typeof exports&&(module.exports=document);

+ 1 - 1
dist/min/inputmask/global/window.min.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.0-beta.52
+* Version: 4.0.0-beta.54
 */
 
 "function"==typeof define&&define.amd?define(function(){return window}):"object"==typeof exports&&(module.exports=window);

File diff suppressed because it is too large
+ 1 - 1
dist/min/inputmask/inputmask.date.extensions.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/min/inputmask/inputmask.extensions.min.js


File diff suppressed because it is too large
+ 2 - 2
dist/min/inputmask/inputmask.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/min/inputmask/inputmask.numeric.extensions.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/min/inputmask/inputmask.phone.extensions.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/min/inputmask/jquery.inputmask.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/min/inputmask/phone-codes/phone-be.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/min/inputmask/phone-codes/phone-ca.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/min/inputmask/phone-codes/phone-hu.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/min/inputmask/phone-codes/phone-it.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/min/inputmask/phone-codes/phone-mx.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/min/inputmask/phone-codes/phone-nl.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/min/inputmask/phone-codes/phone-ru.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/min/inputmask/phone-codes/phone.min.js


File diff suppressed because it is too large
+ 2 - 2
dist/min/jquery.inputmask.bundle.min.js


+ 24 - 38
js/inputmask.js

@@ -817,8 +817,7 @@
                 ignorable = false,
                 maxLength,
                 mouseEnter = false,
-                colorMask,
-                trackCaret = false;
+                colorMask;
 
             //maskset helperfunctions
             function getMaskTemplate(baseOnInput, minimalPos, includeMode, noJit, clearOptionalTail) {
@@ -1872,10 +1871,10 @@
                                         return e.preventDefault();
                                     }
                                     if (mobile) {
-                                        trackCaret = true;
                                         var args = arguments;
                                         setTimeout(function () { //needed for caret selection when entering a char on Android 8 - #1818
                                             eventHandler.apply(that, args);
+                                            caret(that, that.inputmask.caretPos, undefined, true);
                                         }, 0);
                                         return false;
                                     }
@@ -1901,15 +1900,7 @@
                                     }
                                     break;
                             }
-                            // console.log("executed " + e.type);
                             var returnVal = eventHandler.apply(that, arguments);
-                            if (trackCaret) {
-                                trackCaret = false;
-                                setTimeout(function () {
-                                    caret(that, that.inputmask.caretPos, undefined, true);
-                                    // console.log("2 " + JSON.stringify(that.inputmask.caretPos));
-                                });
-                            }
                             if (returnVal === false) {
                                 e.preventDefault();
                                 e.stopPropagation();
@@ -2219,38 +2210,33 @@
                                 }
                             }
 
-                            // setTimeout(function(){
-                            //     console.log("2 " + JSON.stringify(caret(input)));
-                            // },0);
-
                             e.preventDefault();
                         }
                     }
                 },
                 beforeInputEvent: function (e) {
-                    var input = this;
-                    // e.preventDefault(); not working
-                    if (e.cancelable) { // not cancelable
-                        // switch (e.inputType) {
-                        //     case "insertText":
-                        //         $.each(e.data.split(""), function (ndx, entry) {
-                        //             var keypress = new $.Event("keypress");
-                        //             keypress.which = entry.charCodeAt(0);
-                        //             ignorable = false; //make sure ignorable is ignored ;-)
-                        //             EventHandlers.keypressEvent.call(input, keypress);
-                        //         });
-                        //         return e.preventDefault();
-                        //     case "deleteContentBackward":
-                        //         var keydown = new $.Event("keydown");
-                        //         keydown.keyCode = Inputmask.keyCode.DELETE;
-                        //         EventHandlers.keydownEvent.call(input, keydown);
-                        //         return e.preventDefault();
-                        //     case "deleteContentForward":
-                        //         var keydown = new $.Event("keydown");
-                        //         keydown.keyCode = Inputmask.keyCode.BACKSPACE;
-                        //         EventHandlers.keydownEvent.call(input, keydown);
-                        //         return e.preventDefault();
-                        // }
+                    if (e.cancelable) {
+                        var input = this;
+                        switch (e.inputType) {
+                            case "insertText":
+                                $.each(e.data.split(""), function (ndx, entry) {
+                                    var keypress = new $.Event("keypress");
+                                    keypress.which = entry.charCodeAt(0);
+                                    ignorable = false; //make sure ignorable is ignored ;-)
+                                    EventHandlers.keypressEvent.call(input, keypress);
+                                });
+                                return e.preventDefault();
+                            case "deleteContentBackward":
+                                var keydown = new $.Event("keydown");
+                                keydown.keyCode = Inputmask.keyCode.BACKSPACE;
+                                EventHandlers.keydownEvent.call(input, keydown);
+                                return e.preventDefault();
+                            case "deleteContentForward":
+                                var keydown = new $.Event("keydown");
+                                keydown.keyCode = Inputmask.keyCode.DELETE;
+                                EventHandlers.keydownEvent.call(input, keydown);
+                                return e.preventDefault();
+                        }
                     }
                 },
                 setValueEvent: function (e) {

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "inputmask",
-  "version": "4.0.0-beta.52",
+  "version": "4.0.0-beta.54",
   "description": "Inputmask is a javascript library which creates an input mask.  Inputmask can run against vanilla javascript, jQuery and jqlite.",
   "main": "index.js",
   "files": [