Browse Source

postvalidation cannot set pos of undefined

Robin Herbots 8 years ago
parent
commit
e202dcc6b1
43 changed files with 83 additions and 61 deletions
  1. 1 0
      CHANGELOG.md
  2. 1 1
      bower.json
  3. 1 1
      component.json
  4. 1 1
      composer.json
  5. 1 1
      dist/inputmask/bindings/inputmask.binding.js
  6. 1 1
      dist/inputmask/dependencyLibs/inputmask.dependencyLib.jqlite.js
  7. 1 1
      dist/inputmask/dependencyLibs/inputmask.dependencyLib.jquery.js
  8. 1 1
      dist/inputmask/dependencyLibs/inputmask.dependencyLib.js
  9. 1 1
      dist/inputmask/global/document.js
  10. 1 1
      dist/inputmask/global/window.js
  11. 1 1
      dist/inputmask/inputmask.date.extensions.js
  12. 1 1
      dist/inputmask/inputmask.extensions.js
  13. 12 5
      dist/inputmask/inputmask.js
  14. 1 1
      dist/inputmask/inputmask.numeric.extensions.js
  15. 1 1
      dist/inputmask/inputmask.phone.extensions.js
  16. 1 1
      dist/inputmask/jquery.inputmask.js
  17. 1 1
      dist/inputmask/phone-codes/phone-be.js
  18. 1 1
      dist/inputmask/phone-codes/phone-nl.js
  19. 1 1
      dist/inputmask/phone-codes/phone-ru.js
  20. 1 1
      dist/inputmask/phone-codes/phone-uk.js
  21. 1 1
      dist/inputmask/phone-codes/phone.js
  22. 12 5
      dist/jquery.inputmask.bundle.js
  23. 1 1
      dist/min/inputmask/bindings/inputmask.binding.min.js
  24. 1 1
      dist/min/inputmask/dependencyLibs/inputmask.dependencyLib.jqlite.min.js
  25. 1 1
      dist/min/inputmask/dependencyLibs/inputmask.dependencyLib.jquery.min.js
  26. 1 1
      dist/min/inputmask/dependencyLibs/inputmask.dependencyLib.min.js
  27. 1 1
      dist/min/inputmask/global/document.min.js
  28. 1 1
      dist/min/inputmask/global/window.min.js
  29. 1 1
      dist/min/inputmask/inputmask.date.extensions.min.js
  30. 1 1
      dist/min/inputmask/inputmask.extensions.min.js
  31. 3 3
      dist/min/inputmask/inputmask.min.js
  32. 1 1
      dist/min/inputmask/inputmask.numeric.extensions.min.js
  33. 1 1
      dist/min/inputmask/inputmask.phone.extensions.min.js
  34. 1 1
      dist/min/inputmask/jquery.inputmask.min.js
  35. 1 1
      dist/min/inputmask/phone-codes/phone-be.min.js
  36. 1 1
      dist/min/inputmask/phone-codes/phone-nl.min.js
  37. 1 1
      dist/min/inputmask/phone-codes/phone-ru.min.js
  38. 1 1
      dist/min/inputmask/phone-codes/phone-uk.min.js
  39. 1 1
      dist/min/inputmask/phone-codes/phone.min.js
  40. 4 4
      dist/min/jquery.inputmask.bundle.min.js
  41. 15 8
      js/inputmask.js
  42. 0 0
      npm-debug.log.2611415347
  43. 1 1
      package.json

+ 1 - 0
CHANGELOG.md

@@ -6,6 +6,7 @@ All notable changes to this project will be documented in this file.
 - allow custom operation in casing option by callback #1565
 
 ### Updates
+- postvalidation cannot set pos of undefined
 - fix undoValue initialization 
 
 ### Fixed

+ 1 - 1
bower.json

@@ -1,6 +1,6 @@
 {
   "name": "inputmask",
-  "version": "3.3.7-10",
+  "version": "3.3.7-12",
   "main": [
 	  "./dist/inputmask/inputmask.js",
 	  "./dist/inputmask/inputmask.extensions.js",

+ 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": "3.3.7-10",
+	"version": "3.3.7-12",
 	"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": "3.3.7-10",
+  "version": "3.3.7-12",
   "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 - 2017 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.3.7-10
+* Version: 3.3.7-12
 */
 
 !function(factory) {

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

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

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

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

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

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

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

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2017 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.3.7-10
+* Version: 3.3.7-12
 */
 
 "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 - 2017 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.3.7-10
+* Version: 3.3.7-12
 */
 
 "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 - 2017 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.3.7-10
+* Version: 3.3.7-12
 */
 
 !function(factory) {

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

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

+ 12 - 5
dist/inputmask/inputmask.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2017 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.3.7-10
+* Version: 3.3.7-12
 */
 
 !function(factory) {
@@ -247,7 +247,12 @@
                 }
             }
             function filterTests(tests) {
-                return opts.keepStatic && pos > 0 && tests.length > 1 + ("" === tests[tests.length - 1].match.def ? 1 : 0) && !0 !== tests[0].match.optionality && !0 !== tests[0].match.optionalQuantifier && null === tests[0].match.fn && !/[0-9a-bA-Z]/.test(tests[0].match.def) ? [ determineTestTemplate(tests) ] : tests;
+                if (opts.keepStatic && pos > 0 && tests.length > 1 + ("" === tests[tests.length - 1].match.def ? 1 : 0) && !0 !== tests[0].match.optionality && !0 !== tests[0].match.optionalQuantifier && null === tests[0].match.fn && !/[0-9a-bA-Z]/.test(tests[0].match.def)) {
+                    if (getMaskSet().validPositions[pos - 1] === undefined) return [ determineTestTemplate(tests) ];
+                    if (getMaskSet().validPositions[pos - 1].alternation === tests[0].alternation) return [ determineTestTemplate(tests) ];
+                    if (getMaskSet().validPositions[pos - 1]) return [ determineTestTemplate(tests) ];
+                }
+                return tests;
             }
             var latestMatch, maskTokens = getMaskSet().maskToken, testPos = ndxIntlzr ? tstPs : 0, ndxInitializer = ndxIntlzr ? ndxIntlzr.slice() : [ 0 ], matches = [], insertStop = !1, cacheDependency = ndxIntlzr ? ndxIntlzr.join("") : "";
             if (pos > -1) {
@@ -497,7 +502,7 @@
                 }
                 result = !0 === postResult ? result : postResult;
             }
-            return result.pos === undefined && (result.pos = maskPos), !1 === result && (resetMaskSet(!0), 
+            return result && result.pos === undefined && (result.pos = maskPos), !1 === result && (resetMaskSet(!0), 
             getMaskSet().validPositions = $.extend(!0, {}, positionsClone)), result;
         }
         function isMask(pos, strict) {
@@ -921,8 +926,10 @@
                     }
                     if (caretPos.begin > inputValue.length && (caret(input, inputValue.length), caretPos = caret(input)), 
                     getBuffer().length - inputValue.length != 1 || inputValue.charAt(caretPos.begin) === getBuffer()[caretPos.begin] || inputValue.charAt(caretPos.begin + 1) === getBuffer()[caretPos.begin] || isMask(caretPos.begin)) {
-                        var stickyParts = [], bufferTemplate = getMaskTemplate(!0, 1).join("");
-                        for (stickyParts.push(inputValue.substr(0, caretPos.begin)), stickyParts.push(inputValue.substr(caretPos.begin)); null === inputValue.match(Inputmask.escapeRegex(bufferTemplate) + "$"); ) bufferTemplate = bufferTemplate.slice(1);
+                        var stickyParts = [], stickyParts2 = [], buffer = getBuffer().join(""), bufferTemplate = getMaskTemplate(!0, 1).join("");
+                        for (stickyParts.push(inputValue.substr(0, caretPos.begin)), stickyParts.push(inputValue.substr(caretPos.begin)), 
+                        stickyParts2.push(buffer.substr(0, caretPos.begin)), stickyParts2.push(buffer.substr(caretPos.begin)), 
+                        console.log(stickyParts[0] + " , " + stickyParts[1] + " vs " + stickyParts2[0] + " , " + stickyParts2[1]); null === inputValue.match(Inputmask.escapeRegex(bufferTemplate) + "$"); ) bufferTemplate = bufferTemplate.slice(1);
                         inputValue = inputValue.replace(bufferTemplate, ""), $.isFunction(opts.onBeforeMask) && (inputValue = opts.onBeforeMask(inputValue, opts) || inputValue), 
                         checkVal(input, !0, !1, inputValue.split(""), e);
                         var currentPos = caret(input).begin, currentValue = input.inputmask._valueGet(), pos1 = currentValue.indexOf(stickyParts[0]);

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

+ 12 - 5
dist/jquery.inputmask.bundle.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2017 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.3.7-10
+* Version: 3.3.7-12
 */
 
 !function(factory) {
@@ -246,7 +246,12 @@
                     }
                 }
                 function filterTests(tests) {
-                    return opts.keepStatic && pos > 0 && tests.length > 1 + ("" === tests[tests.length - 1].match.def ? 1 : 0) && !0 !== tests[0].match.optionality && !0 !== tests[0].match.optionalQuantifier && null === tests[0].match.fn && !/[0-9a-bA-Z]/.test(tests[0].match.def) ? [ determineTestTemplate(tests) ] : tests;
+                    if (opts.keepStatic && pos > 0 && tests.length > 1 + ("" === tests[tests.length - 1].match.def ? 1 : 0) && !0 !== tests[0].match.optionality && !0 !== tests[0].match.optionalQuantifier && null === tests[0].match.fn && !/[0-9a-bA-Z]/.test(tests[0].match.def)) {
+                        if (getMaskSet().validPositions[pos - 1] === undefined) return [ determineTestTemplate(tests) ];
+                        if (getMaskSet().validPositions[pos - 1].alternation === tests[0].alternation) return [ determineTestTemplate(tests) ];
+                        if (getMaskSet().validPositions[pos - 1]) return [ determineTestTemplate(tests) ];
+                    }
+                    return tests;
                 }
                 var latestMatch, maskTokens = getMaskSet().maskToken, testPos = ndxIntlzr ? tstPs : 0, ndxInitializer = ndxIntlzr ? ndxIntlzr.slice() : [ 0 ], matches = [], insertStop = !1, cacheDependency = ndxIntlzr ? ndxIntlzr.join("") : "";
                 if (pos > -1) {
@@ -496,7 +501,7 @@
                     }
                     result = !0 === postResult ? result : postResult;
                 }
-                return result.pos === undefined && (result.pos = maskPos), !1 === result && (resetMaskSet(!0), 
+                return result && result.pos === undefined && (result.pos = maskPos), !1 === result && (resetMaskSet(!0), 
                 getMaskSet().validPositions = $.extend(!0, {}, positionsClone)), result;
             }
             function isMask(pos, strict) {
@@ -920,8 +925,10 @@
                         }
                         if (caretPos.begin > inputValue.length && (caret(input, inputValue.length), caretPos = caret(input)), 
                         getBuffer().length - inputValue.length != 1 || inputValue.charAt(caretPos.begin) === getBuffer()[caretPos.begin] || inputValue.charAt(caretPos.begin + 1) === getBuffer()[caretPos.begin] || isMask(caretPos.begin)) {
-                            var stickyParts = [], bufferTemplate = getMaskTemplate(!0, 1).join("");
-                            for (stickyParts.push(inputValue.substr(0, caretPos.begin)), stickyParts.push(inputValue.substr(caretPos.begin)); null === inputValue.match(Inputmask.escapeRegex(bufferTemplate) + "$"); ) bufferTemplate = bufferTemplate.slice(1);
+                            var stickyParts = [], stickyParts2 = [], buffer = getBuffer().join(""), bufferTemplate = getMaskTemplate(!0, 1).join("");
+                            for (stickyParts.push(inputValue.substr(0, caretPos.begin)), stickyParts.push(inputValue.substr(caretPos.begin)), 
+                            stickyParts2.push(buffer.substr(0, caretPos.begin)), stickyParts2.push(buffer.substr(caretPos.begin)), 
+                            console.log(stickyParts[0] + " , " + stickyParts[1] + " vs " + stickyParts2[0] + " , " + stickyParts2[1]); null === inputValue.match(Inputmask.escapeRegex(bufferTemplate) + "$"); ) bufferTemplate = bufferTemplate.slice(1);
                             inputValue = inputValue.replace(bufferTemplate, ""), $.isFunction(opts.onBeforeMask) && (inputValue = opts.onBeforeMask(inputValue, opts) || inputValue), 
                             checkVal(input, !0, !1, inputValue.split(""), e);
                             var currentPos = caret(input).begin, currentValue = input.inputmask._valueGet(), pos1 = currentValue.indexOf(stickyParts[0]);

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 - 2017 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.3.7-10
+* Version: 3.3.7-12
 */
 
 !function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof exports?module.exports=a(require("jquery")):window.dependencyLib=a(jQuery)}(function(a){return a});

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 - 2017 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.3.7-10
+* Version: 3.3.7-12
 */
 
 "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 - 2017 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.3.7-10
+* Version: 3.3.7-12
 */
 
 "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
+ 3 - 3
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-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-uk.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
+ 4 - 4
dist/min/jquery.inputmask.bundle.min.js


+ 15 - 8
js/inputmask.js

@@ -1264,10 +1264,14 @@
 						if (tests.length > 1 + (tests[tests.length - 1].match.def === "" ? 1 : 0)) {
 							if (tests[0].match.optionality !== true &&
 								tests[0].match.optionalQuantifier !== true &&
-								tests[0].match.fn === null && !/[0-9a-bA-Z]/.test(tests[0].match.def) &&
-									(true || getMaskSet().validPositions[pos - 1] === undefined ||
-									getMaskSet().validPositions[pos - 1].alternation === tests[0].alternation)) {
-								return [determineTestTemplate(tests)];
+								tests[0].match.fn === null && !/[0-9a-bA-Z]/.test(tests[0].match.def)) {
+								if (getMaskSet().validPositions[pos - 1] === undefined)
+									return [determineTestTemplate(tests)];
+								else if (getMaskSet().validPositions[pos - 1].alternation === tests[0].alternation) {
+									return [determineTestTemplate(tests)];
+								} else if (getMaskSet().validPositions[pos - 1]) {
+									return [determineTestTemplate(tests)];
+								}
 							}
 						}
 					}
@@ -1318,7 +1322,7 @@
 					return filterTests($.extend(true, [], matches));
 				}
 				getMaskSet().tests[pos] = $.extend(true, [], matches); //set a clone to prevent overwriting some props
-				// console.log(pos + " - " + JSON.stringify(matches));
+// console.log(pos + " - " + JSON.stringify(matches));
 				return filterTests(getMaskSet().tests[pos]);
 			}
 
@@ -1792,7 +1796,7 @@
 					result = postResult === true ? result : postResult;
 				}
 
-				if (result.pos === undefined) {
+				if (result && result.pos === undefined) {
 					result.pos = maskPos;
 				}
 
@@ -2533,10 +2537,13 @@
 							e.keyCode = Inputmask.keyCode.BACKSPACE;
 							EventHandlers.keydownEvent.call(input, e);
 						} else {
-							var stickyParts = [], bufferTemplate = getMaskTemplate(true, 1).join("");
+							var stickyParts = [], stickyParts2 = [], buffer = getBuffer().join(""),
+								bufferTemplate = getMaskTemplate(true, 1).join("");
 							stickyParts.push(inputValue.substr(0, caretPos.begin));
 							stickyParts.push(inputValue.substr(caretPos.begin));
-							// console.log(stickyParts[0] + " , " + stickyParts[1]);
+							stickyParts2.push(buffer.substr(0, caretPos.begin));
+							stickyParts2.push(buffer.substr(caretPos.begin));
+							console.log(stickyParts[0] + " , " + stickyParts[1] + " vs " + stickyParts2[0] + " , " + stickyParts2[1]);
 							while (inputValue.match(Inputmask.escapeRegex(bufferTemplate) + "$") === null) {
 								bufferTemplate = bufferTemplate.slice(1);
 							}

+ 0 - 0
npm-debug.log.2611415347


+ 1 - 1
package.json

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