ソースを参照

update inputfallback

Robin Herbots 8 年 前
コミット
6dc37844e2
44 ファイル変更3577 行追加569 行削除
  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. 16 20
      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-nl.js
  18. 1 1
      dist/inputmask/phone-codes/phone-ru.js
  19. 1 1
      dist/inputmask/phone-codes/phone-uk.js
  20. 1 1
      dist/inputmask/phone-codes/phone.js
  21. 16 20
      dist/jquery.inputmask.bundle.js
  22. 1 1
      dist/min/inputmask/bindings/inputmask.binding.min.js
  23. 1 1
      dist/min/inputmask/dependencyLibs/inputmask.dependencyLib.jqlite.min.js
  24. 1 1
      dist/min/inputmask/dependencyLibs/inputmask.dependencyLib.jquery.min.js
  25. 1 1
      dist/min/inputmask/dependencyLibs/inputmask.dependencyLib.min.js
  26. 1 1
      dist/min/inputmask/global/document.min.js
  27. 1 1
      dist/min/inputmask/global/window.min.js
  28. 1 1
      dist/min/inputmask/inputmask.date.extensions.min.js
  29. 1 1
      dist/min/inputmask/inputmask.extensions.min.js
  30. 3 3
      dist/min/inputmask/inputmask.min.js
  31. 1 1
      dist/min/inputmask/inputmask.numeric.extensions.min.js
  32. 1 1
      dist/min/inputmask/inputmask.phone.extensions.min.js
  33. 1 1
      dist/min/inputmask/jquery.inputmask.min.js
  34. 1 1
      dist/min/inputmask/phone-codes/phone-be.min.js
  35. 1 1
      dist/min/inputmask/phone-codes/phone-nl.min.js
  36. 1 1
      dist/min/inputmask/phone-codes/phone-ru.min.js
  37. 1 1
      dist/min/inputmask/phone-codes/phone-uk.min.js
  38. 1 1
      dist/min/inputmask/phone-codes/phone.min.js
  39. 3 3
      dist/min/jquery.inputmask.bundle.min.js
  40. 2 7
      js/inputmask.js
  41. 3475 473
      package-lock.json
  42. 1 1
      package.json
  43. 7 7
      qunit/simulator.js
  44. 19 0
      qunit/tests_inputeventonly.js

+ 1 - 1
bower.json

@@ -1,6 +1,6 @@
 {
   "name": "inputmask",
-  "version": "4.0.1-13",
+  "version": "4.0.1-14",
   "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": "4.0.1-13",
+	"version": "4.0.1-14",
 	"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.1-13",
+  "version": "4.0.1-14",
   "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: 4.0.1-13
+* Version: 4.0.1-14
 */
 
 !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: 4.0.1-13
+* Version: 4.0.1-14
 */
 
 !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: 4.0.1-13
+* Version: 4.0.1-14
 */
 
 !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: 4.0.1-13
+* Version: 4.0.1-14
 */
 
 !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: 4.0.1-13
+* Version: 4.0.1-14
 */
 
 "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: 4.0.1-13
+* Version: 4.0.1-14
 */
 
 "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: 4.0.1-13
+* Version: 4.0.1-14
 */
 
 !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: 4.0.1-13
+* Version: 4.0.1-14
 */
 
 !function(factory) {

+ 16 - 20
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: 4.0.1-13
+* Version: 4.0.1-14
 */
 
 !function(factory) {
@@ -905,7 +905,7 @@
                         inputValue[caretPos.begin - 1] = opts.radixPoint.charAt(0), inputValue = inputValue.join("")), 
                         inputValue.charAt(caretPos.begin - 1) === opts.radixPoint && inputValue.length > getBuffer().length) {
                             var keypress = new $.Event("keypress");
-                            return keypress.which = opts.radixPoint.charCodeAt(0), EventHandlers.keypressEvent.call(input, keypress, !0, !0, !1, caretPos.begin), 
+                            return keypress.which = opts.radixPoint.charCodeAt(0), EventHandlers.keypressEvent.call(input, keypress, !0, !0, !1, caretPos.begin - 1), 
                             !1;
                         }
                     }(input, inputValue, caretPos)) return !1;
@@ -932,25 +932,21 @@
                         }
                         selection.begin !== selection.end || isMask(selection.begin) || (selection.end = caretPos.end);
                     }
-                    if (selection.begin < selection.end) writeBuffer(input, getBuffer(), selection), 
-                    frontPart.charCodeAt(frontPart.length - 1) !== frontBufferPart.charCodeAt(frontBufferPart.length - 1) ? (e.which = frontPart.charCodeAt(frontPart.length - 1), 
+                    selection.begin < selection.end ? (writeBuffer(input, getBuffer(), selection), frontPart.split("")[frontPart.length - 1] !== frontBufferPart.split("")[frontBufferPart.length - 1] ? (e.which = frontPart.charCodeAt(frontPart.length - 1), 
                     ignorable = !1, EventHandlers.keypressEvent.call(input, e)) : (selection.begin === selection.end - 1 && caret(input, seekPrevious(selection.begin + 1), selection.end), 
-                    e.keyCode = Inputmask.keyCode.DELETE, EventHandlers.keydownEvent.call(input, e)); else {
-                        for (var bufferTemplate = getBufferTemplate().join(""); 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), function(input, frontPart, backPart) {
-                            var targetPos = caret(input).begin, currentValue = input.inputmask._valueGet(), pos = currentValue.indexOf(frontPart), currentPos = targetPos;
-                            if (0 === pos && targetPos !== frontPart.length) targetPos = frontPart.length; else {
-                                for (;null === currentValue.match(Inputmask.escapeRegex(backPart) + "$"); ) backPart = backPart.substr(1);
-                                var pos2 = currentValue.indexOf(backPart);
-                                -1 !== pos2 && "" !== backPart && targetPos > pos2 && pos2 > pos && (targetPos = pos2);
-                            }
-                            isMask(targetPos) || (targetPos = seekNext(targetPos)), currentPos !== targetPos && (caret(input, targetPos), 
-                            android && setTimeout(function() {
-                                caret(input, targetPos);
-                            }, 0));
-                        }(input, frontPart, backPart), !0 === isComplete(getBuffer()) && $(input).trigger("complete");
-                    }
+                    e.keyCode = Inputmask.keyCode.DELETE, EventHandlers.keydownEvent.call(input, e))) : ($.isFunction(opts.onBeforeMask) && (inputValue = opts.onBeforeMask(inputValue, opts) || inputValue), 
+                    checkVal(input, !0, !1, inputValue.split(""), e), function(input, frontPart, backPart) {
+                        var targetPos = caret(input).begin, currentValue = input.inputmask._valueGet(), pos = currentValue.indexOf(frontPart), currentPos = targetPos;
+                        if (0 === pos && targetPos !== frontPart.length) targetPos = frontPart.length; else {
+                            for (;null === currentValue.match(Inputmask.escapeRegex(backPart) + "$"); ) backPart = backPart.substr(1);
+                            var pos2 = currentValue.indexOf(backPart);
+                            -1 !== pos2 && "" !== backPart && targetPos > pos2 && pos2 > pos && (targetPos = pos2);
+                        }
+                        isMask(targetPos) || (targetPos = seekNext(targetPos)), currentPos !== targetPos && (caret(input, targetPos), 
+                        android && setTimeout(function() {
+                            caret(input, targetPos);
+                        }, 0));
+                    }(input, frontPart, backPart), !0 === isComplete(getBuffer()) && $(input).trigger("complete")), 
                     e.preventDefault();
                 }
             },

+ 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: 4.0.1-13
+* Version: 4.0.1-14
 */
 
 !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: 4.0.1-13
+* Version: 4.0.1-14
 */
 
 !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: 4.0.1-13
+* Version: 4.0.1-14
 */
 
 !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: 4.0.1-13
+* Version: 4.0.1-14
 */
 
 !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: 4.0.1-13
+* Version: 4.0.1-14
 */
 
 !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: 4.0.1-13
+* Version: 4.0.1-14
 */
 
 !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: 4.0.1-13
+* Version: 4.0.1-14
 */
 
 !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: 4.0.1-13
+* Version: 4.0.1-14
 */
 
 !function(factory) {

+ 16 - 20
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: 4.0.1-13
+* Version: 4.0.1-14
 */
 
 !function(modules) {
@@ -953,7 +953,7 @@
                             inputValue[caretPos.begin - 1] = opts.radixPoint.charAt(0), inputValue = inputValue.join("")), 
                             inputValue.charAt(caretPos.begin - 1) === opts.radixPoint && inputValue.length > getBuffer().length) {
                                 var keypress = new $.Event("keypress");
-                                return keypress.which = opts.radixPoint.charCodeAt(0), EventHandlers.keypressEvent.call(input, keypress, !0, !0, !1, caretPos.begin), 
+                                return keypress.which = opts.radixPoint.charCodeAt(0), EventHandlers.keypressEvent.call(input, keypress, !0, !0, !1, caretPos.begin - 1), 
                                 !1;
                             }
                         }(input, inputValue, caretPos)) return !1;
@@ -980,25 +980,21 @@
                             }
                             selection.begin !== selection.end || isMask(selection.begin) || (selection.end = caretPos.end);
                         }
-                        if (selection.begin < selection.end) writeBuffer(input, getBuffer(), selection), 
-                        frontPart.charCodeAt(frontPart.length - 1) !== frontBufferPart.charCodeAt(frontBufferPart.length - 1) ? (e.which = frontPart.charCodeAt(frontPart.length - 1), 
+                        selection.begin < selection.end ? (writeBuffer(input, getBuffer(), selection), frontPart.split("")[frontPart.length - 1] !== frontBufferPart.split("")[frontBufferPart.length - 1] ? (e.which = frontPart.charCodeAt(frontPart.length - 1), 
                         ignorable = !1, EventHandlers.keypressEvent.call(input, e)) : (selection.begin === selection.end - 1 && caret(input, seekPrevious(selection.begin + 1), selection.end), 
-                        e.keyCode = Inputmask.keyCode.DELETE, EventHandlers.keydownEvent.call(input, e)); else {
-                            for (var bufferTemplate = getBufferTemplate().join(""); 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), function(input, frontPart, backPart) {
-                                var targetPos = caret(input).begin, currentValue = input.inputmask._valueGet(), pos = currentValue.indexOf(frontPart), currentPos = targetPos;
-                                if (0 === pos && targetPos !== frontPart.length) targetPos = frontPart.length; else {
-                                    for (;null === currentValue.match(Inputmask.escapeRegex(backPart) + "$"); ) backPart = backPart.substr(1);
-                                    var pos2 = currentValue.indexOf(backPart);
-                                    -1 !== pos2 && "" !== backPart && targetPos > pos2 && pos2 > pos && (targetPos = pos2);
-                                }
-                                isMask(targetPos) || (targetPos = seekNext(targetPos)), currentPos !== targetPos && (caret(input, targetPos), 
-                                android && setTimeout(function() {
-                                    caret(input, targetPos);
-                                }, 0));
-                            }(input, frontPart, backPart), !0 === isComplete(getBuffer()) && $(input).trigger("complete");
-                        }
+                        e.keyCode = Inputmask.keyCode.DELETE, EventHandlers.keydownEvent.call(input, e))) : ($.isFunction(opts.onBeforeMask) && (inputValue = opts.onBeforeMask(inputValue, opts) || inputValue), 
+                        checkVal(input, !0, !1, inputValue.split(""), e), function(input, frontPart, backPart) {
+                            var targetPos = caret(input).begin, currentValue = input.inputmask._valueGet(), pos = currentValue.indexOf(frontPart), currentPos = targetPos;
+                            if (0 === pos && targetPos !== frontPart.length) targetPos = frontPart.length; else {
+                                for (;null === currentValue.match(Inputmask.escapeRegex(backPart) + "$"); ) backPart = backPart.substr(1);
+                                var pos2 = currentValue.indexOf(backPart);
+                                -1 !== pos2 && "" !== backPart && targetPos > pos2 && pos2 > pos && (targetPos = pos2);
+                            }
+                            isMask(targetPos) || (targetPos = seekNext(targetPos)), currentPos !== targetPos && (caret(input, targetPos), 
+                            android && setTimeout(function() {
+                                caret(input, targetPos);
+                            }, 0));
+                        }(input, frontPart, backPart), !0 === isComplete(getBuffer()) && $(input).trigger("complete")), 
                         e.preventDefault();
                     }
                 },

ファイルの差分が大きいため隠しています
+ 1 - 1
dist/min/inputmask/bindings/inputmask.binding.min.js


ファイルの差分が大きいため隠しています
+ 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: 4.0.1-13
+* Version: 4.0.1-14
 */
 
 !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});

ファイルの差分が大きいため隠しています
+ 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: 4.0.1-13
+* Version: 4.0.1-14
 */
 
 "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: 4.0.1-13
+* Version: 4.0.1-14
 */
 
 "function"==typeof define&&define.amd?define(function(){return window}):"object"==typeof exports&&(module.exports=window);

ファイルの差分が大きいため隠しています
+ 1 - 1
dist/min/inputmask/inputmask.date.extensions.min.js


ファイルの差分が大きいため隠しています
+ 1 - 1
dist/min/inputmask/inputmask.extensions.min.js


ファイルの差分が大きいため隠しています
+ 3 - 3
dist/min/inputmask/inputmask.min.js


ファイルの差分が大きいため隠しています
+ 1 - 1
dist/min/inputmask/inputmask.numeric.extensions.min.js


ファイルの差分が大きいため隠しています
+ 1 - 1
dist/min/inputmask/inputmask.phone.extensions.min.js


ファイルの差分が大きいため隠しています
+ 1 - 1
dist/min/inputmask/jquery.inputmask.min.js


ファイルの差分が大きいため隠しています
+ 1 - 1
dist/min/inputmask/phone-codes/phone-be.min.js


ファイルの差分が大きいため隠しています
+ 1 - 1
dist/min/inputmask/phone-codes/phone-nl.min.js


ファイルの差分が大きいため隠しています
+ 1 - 1
dist/min/inputmask/phone-codes/phone-ru.min.js


ファイルの差分が大きいため隠しています
+ 1 - 1
dist/min/inputmask/phone-codes/phone-uk.min.js


ファイルの差分が大きいため隠しています
+ 1 - 1
dist/min/inputmask/phone-codes/phone.min.js


ファイルの差分が大きいため隠しています
+ 3 - 3
dist/min/jquery.inputmask.bundle.min.js


+ 2 - 7
js/inputmask.js

@@ -2565,7 +2565,7 @@
                         if (inputValue.charAt(caretPos.begin - 1) === opts.radixPoint && inputValue.length > getBuffer().length) {
                             var keypress = new $.Event("keypress");
                             keypress.which = opts.radixPoint.charCodeAt(0);
-                            EventHandlers.keypressEvent.call(input, keypress, true, true, false, caretPos.begin);
+                            EventHandlers.keypressEvent.call(input, keypress, true, true, false, caretPos.begin - 1);
                             return false;
 
                         }
@@ -2626,7 +2626,7 @@
                         //is selection
                         if (selection.begin < selection.end) {
                             writeBuffer(input, getBuffer(), selection);
-                            if (frontPart.charCodeAt(frontPart.length - 1) !== frontBufferPart.charCodeAt(frontBufferPart.length - 1)) {
+                            if (frontPart.split("")[frontPart.length - 1] !== frontBufferPart.split("")[frontBufferPart.length - 1]) {
                                 e.which = frontPart.charCodeAt(frontPart.length - 1);
                                 ignorable = false; //make sure ignorable is ignored ;-)
                                 EventHandlers.keypressEvent.call(input, e);
@@ -2638,11 +2638,6 @@
                                 EventHandlers.keydownEvent.call(input, e);
                             }
                         } else {
-                            var bufferTemplate = getBufferTemplate().join("");
-                            while (inputValue.match(Inputmask.escapeRegex(bufferTemplate) + "$") === null) {
-                                bufferTemplate = bufferTemplate.slice(1);
-                            }
-                            inputValue = inputValue.replace(bufferTemplate, "");
                             if ($.isFunction(opts.onBeforeMask)) inputValue = opts.onBeforeMask(inputValue, opts) || inputValue;
                             checkVal(input, true, false, inputValue.split(""), e);
                             repositionCaret(input, frontPart, backPart);

ファイルの差分が大きいため隠しています
+ 3475 - 473
package-lock.json


+ 1 - 1
package.json

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

+ 7 - 7
qunit/simulator.js

@@ -62,7 +62,7 @@ export default function ($, Inputmask) {
     };
     $.fn = $.fn || $.prototype;
     $.fn.SendKey = function (keyCode, modifier) {
-        var elem = this.nodeName ? this : this[0];
+        var elem = this.nodeName ? this : this[0], origCode = keyCode;
 
         function trigger(elem, evnt) {
             elem.focus();
@@ -100,11 +100,11 @@ export default function ($, Inputmask) {
                 if ((window.Inputmask && window.Inputmask.prototype.defaults.inputEventOnly === true) ||
                     (elem.inputmask && elem.inputmask.opts.inputEventOnly === true)) {
                     var input = new $.Event("input"),
-                        currentValue = elem.inputmask.__valueGet ? elem.inputmask.__valueGet.call(elem) : elem.value,
+                        currentValue = (elem.inputmask && elem.inputmask.__valueGet) ? elem.inputmask.__valueGet.call(elem) : elem.value,
                         caretPos = $.caret(elem);
 
-                    console.log("initial " + currentValue);
-                    console.log(caretPos);
+                    // console.log("initial " + currentValue);
+                    // console.log(caretPos);
 
                     var front = currentValue.substring(0, caretPos.begin),
                         back = currentValue.substring(caretPos.end),
@@ -116,7 +116,7 @@ export default function ($, Inputmask) {
                                 front = front.substr(0, front.length - 1)
                             newValue = front + back;
                             break;
-                        case Inputmask.keyCode.DELETE :
+                        case Inputmask.keyCode.DELETE && origCode !== ".":
                             if (caretPos.begin === caretPos.end)
                                 back = back.substr(1);
                             newValue = front + back;
@@ -125,12 +125,12 @@ export default function ($, Inputmask) {
                             newValue = front + String.fromCharCode(keyCode) + back;
                     }
 
-                    if (elem.inputmask.__valueSet)
+                    if (elem.inputmask && elem.inputmask.__valueSet)
                         elem.inputmask.__valueSet.call(elem, newValue);
                     else elem.value = newValue;
 
                     $.caret(elem, newValue.length - back.length);
-                    console.log("new " + newValue);
+                    // console.log("new " + newValue);
                     trigger(this.nodeName ? this : this[0], input);
                 } else {
                     var keydown = new $.Event("keydown"),

+ 19 - 0
qunit/tests_inputeventonly.js

@@ -71,4 +71,23 @@ export default function (qunit, $, Inputmask) {
         $(testmask).input("12349", 5);
         assert.ok($.caret(testmask).begin == 3, "Caret " + $.caret(testmask).begin);
     });
+
+    qunit.test("numeric placeholder 0 - alexey-m-ukolov", function (assert) {
+        var $fixture = $("#qunit-fixture");
+        $fixture.append('<input type="text" id="testmask" />');
+        var testmask = document.getElementById("testmask");
+        Inputmask({
+            alias: 'numeric',
+            placeholder: '0',
+            inputEventOnly: true,
+            colorMask: true,
+            androidHack: "rtfm"
+        }, {inputEventOnly: true}).mask(testmask);
+
+        testmask.focus();
+        //simulate input
+        $(testmask).input("10");
+
+        assert.equal(testmask.value, "10", "Result " + testmask.value);
+    });
 };