浏览代码

fix in shiftr

Robin Herbots 11 年之前
父节点
当前提交
268cf31dcd

+ 1 - 1
bower.json

@@ -1,6 +1,6 @@
 {
     "name": "jquery.inputmask",
-    "version": "2.5.2",
+    "version": "2.5.3",
     "main": "./dist/jquery.inputmask.bundle.js",
 	"keywords" : ["jQuery", "plugins", "input", "form", "inputmask", "mask"],
 	"description": "jquery.inputmask is a jquery plugin which create an input mask.",

+ 1 - 1
build.properties

@@ -7,7 +7,7 @@ distdir = dist
 
 build.major = 2
 build.minor = 5
-build.revision = 2
+build.revision = 3
 
 target = jquery.inputmask.bundle.js
 target.min = jquery.inputmask.bundle.min.js

二进制
dist/jQuery.InputMask.2.5.2.nupkg


二进制
dist/jQuery.InputMask.2.5.3.nupkg


+ 16 - 11
dist/jquery.inputmask.bundle.js

@@ -3,7 +3,7 @@
 * http://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2014 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 2.5.2
+* Version: 2.5.3
 */
 
 (function ($) {
@@ -841,7 +841,7 @@
                             var j = seekPrevious(i);
                             var t = getBufferElement(buffer, j);
                             if (t != getPlaceHolder(j)) {
-                                if (isValid(j, t, true) !== false && getActiveTests()[determineTestPosition(i)].def == getActiveTests()[determineTestPosition(j)].def) {
+                                if (isValid(i, t, true) !== false && getActiveTests()[determineTestPosition(i)].def == getActiveTests()[determineTestPosition(j)].def) {
                                     setBufferElement(buffer, i, t, true);
                                     setReTargetPlaceHolder(buffer, j);
                                 } //else break;
@@ -1699,7 +1699,7 @@ Input Mask plugin extensions
 http://github.com/RobinHerbots/jquery.inputmask
 Copyright (c) 2010 - 2014 Robin Herbots
 Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-Version: 2.5.2
+Version: 2.5.3
 
 Optional extensions on the jquery.inputmask base
 */
@@ -1821,7 +1821,7 @@ Input Mask plugin extensions
 http://github.com/RobinHerbots/jquery.inputmask
 Copyright (c) 2010 - 2014 Robin Herbots
 Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-Version: 2.5.2
+Version: 2.5.3
 
 Optional extensions on the jquery.inputmask base
 */
@@ -2309,7 +2309,7 @@ Input Mask plugin extensions
 http://github.com/RobinHerbots/jquery.inputmask
 Copyright (c) 2010 - 2014 Robin Herbots
 Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-Version: 2.5.2
+Version: 2.5.3
 
 Optional extensions on the jquery.inputmask base
 */
@@ -2414,6 +2414,7 @@ Optional extensions on the jquery.inputmask base
             definitions: {
                 '~': { //real number
                     validator: function (chrs, buffer, pos, strict, opts) {
+                        var iopts = $.extend({}, opts, { digits: strict ? "*" : opts.digits });
                         if (chrs == "") return false;
                         if (!strict && pos <= 1 && buffer[0] === '0' && new RegExp("[\\d-]").test(chrs) && buffer.join('').length == 1) { //handle first char
                             buffer[0] = "";
@@ -2428,13 +2429,17 @@ Optional extensions on the jquery.inputmask base
                         //strip groupseparator
                         var escapedGroupSeparator = $.inputmask.escapeRegex.call(this, opts.groupSeparator);
                         bufferStr = bufferStr.replace(new RegExp(escapedGroupSeparator, "g"), '');
+                        if (strict && bufferStr.lastIndexOf(opts.radixPoint) == bufferStr.length - 1) {
+                            var escapedRadixPoint = $.inputmask.escapeRegex.call(this, opts.radixPoint);
+                            bufferStr = bufferStr.replace(new RegExp(escapedRadixPoint, "g"), '');
+                        }
                         if (!strict && bufferStr == "") return false;
 
-                        var isValid = opts.regex.number(opts).test(bufferStr);
+                        var isValid = opts.regex.number(iopts).test(bufferStr);
                         if (!isValid) {
                             //let's help the regex a bit
                             bufferStr += "0";
-                            isValid = opts.regex.number(opts).test(bufferStr);
+                            isValid = opts.regex.number(iopts).test(bufferStr);
                             if (!isValid) {
                                 //make a valid group
                                 var lastGroupSeparator = bufferStr.lastIndexOf(opts.groupSeparator);
@@ -2442,10 +2447,10 @@ Optional extensions on the jquery.inputmask base
                                     bufferStr += "0";
                                 }
 
-                                isValid = opts.regex.number(opts).test(bufferStr);
+                                isValid = opts.regex.number(iopts).test(bufferStr);
                                 if (!isValid && !strict) {
                                     if (chrs == opts.radixPoint) {
-                                        isValid = opts.regex.number(opts).test("0" + bufferStr + "0");
+                                        isValid = opts.regex.number(iopts).test("0" + bufferStr + "0");
                                         if (isValid) {
                                             buffer[pos] = "0";
                                             pos++;
@@ -2487,7 +2492,7 @@ Input Mask plugin extensions
 http://github.com/RobinHerbots/jquery.inputmask
 Copyright (c) 2010 - 2014 Robin Herbots
 Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-Version: 2.5.2
+Version: 2.5.3
 
 Regex extensions on the jquery.inputmask base
 Allows for using regular expressions as a mask
@@ -2671,7 +2676,7 @@ Input Mask plugin extensions
 http://github.com/RobinHerbots/jquery.inputmask
 Copyright (c) 2010 - 2014 Robin Herbots
 Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-Version: 2.5.2
+Version: 2.5.3
 
 Phone extension.
 When using this extension make sure you specify the correct url to get the masks

文件差异内容过多而无法显示
+ 62 - 62
dist/jquery.inputmask.bundle.min.js


文件差异内容过多而无法显示
+ 2 - 2
dist/min/jquery.inputmask.js


文件差异内容过多而无法显示
+ 7 - 7
dist/min/jquery.inputmask.numeric.extensions.js


+ 1 - 1
jquery.inputmask.jquery.json

@@ -8,7 +8,7 @@
 		"inputmask",
 		"mask"
     ],
-    "version": "2.5.2",
+    "version": "2.5.3",
     "author": {
         "name": "Robin Herbots",
         "url": "http://github.com/RobinHerbots/jquery.inputmask"

+ 1 - 1
js/jquery.inputmask.js

@@ -841,7 +841,7 @@
                             var j = seekPrevious(i);
                             var t = getBufferElement(buffer, j);
                             if (t != getPlaceHolder(j)) {
-                                if (isValid(j, t, true) !== false && getActiveTests()[determineTestPosition(i)].def == getActiveTests()[determineTestPosition(j)].def) {
+                                if (isValid(i, t, true) !== false && getActiveTests()[determineTestPosition(i)].def == getActiveTests()[determineTestPosition(j)].def) {
                                     setBufferElement(buffer, i, t, true);
                                     setReTargetPlaceHolder(buffer, j);
                                 } //else break;

+ 9 - 4
js/jquery.inputmask.numeric.extensions.js

@@ -108,6 +108,7 @@ Optional extensions on the jquery.inputmask base
             definitions: {
                 '~': { //real number
                     validator: function (chrs, buffer, pos, strict, opts) {
+                        var iopts = $.extend({}, opts, { digits: strict ? "*" : opts.digits });
                         if (chrs == "") return false;
                         if (!strict && pos <= 1 && buffer[0] === '0' && new RegExp("[\\d-]").test(chrs) && buffer.join('').length == 1) { //handle first char
                             buffer[0] = "";
@@ -122,13 +123,17 @@ Optional extensions on the jquery.inputmask base
                         //strip groupseparator
                         var escapedGroupSeparator = $.inputmask.escapeRegex.call(this, opts.groupSeparator);
                         bufferStr = bufferStr.replace(new RegExp(escapedGroupSeparator, "g"), '');
+                        if (strict && bufferStr.lastIndexOf(opts.radixPoint) == bufferStr.length - 1) {
+                            var escapedRadixPoint = $.inputmask.escapeRegex.call(this, opts.radixPoint);
+                            bufferStr = bufferStr.replace(new RegExp(escapedRadixPoint, "g"), '');
+                        }
                         if (!strict && bufferStr == "") return false;
 
-                        var isValid = opts.regex.number(opts).test(bufferStr);
+                        var isValid = opts.regex.number(iopts).test(bufferStr);
                         if (!isValid) {
                             //let's help the regex a bit
                             bufferStr += "0";
-                            isValid = opts.regex.number(opts).test(bufferStr);
+                            isValid = opts.regex.number(iopts).test(bufferStr);
                             if (!isValid) {
                                 //make a valid group
                                 var lastGroupSeparator = bufferStr.lastIndexOf(opts.groupSeparator);
@@ -136,10 +141,10 @@ Optional extensions on the jquery.inputmask base
                                     bufferStr += "0";
                                 }
 
-                                isValid = opts.regex.number(opts).test(bufferStr);
+                                isValid = opts.regex.number(iopts).test(bufferStr);
                                 if (!isValid && !strict) {
                                     if (chrs == opts.radixPoint) {
-                                        isValid = opts.regex.number(opts).test("0" + bufferStr + "0");
+                                        isValid = opts.regex.number(iopts).test("0" + bufferStr + "0");
                                         if (isValid) {
                                             buffer[pos] = "0";
                                             pos++;