Robin Herbots 12 years ago
parent
commit
6c0f764cfb

+ 1 - 1
build.properties

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

+ 1 - 1
component.json

@@ -1,6 +1,6 @@
 {
 {
     "name": "jquery.inputmask",
     "name": "jquery.inputmask",
-    "version": "2.4.6",
+    "version": "2.4.7",
     "main": "./dist/jquery.inputmask.bundle.js",
     "main": "./dist/jquery.inputmask.bundle.js",
     "dependencies": {
     "dependencies": {
         "jquery": ">=1.7"
         "jquery": ">=1.7"

BIN
dist/jQuery.InputMask.2.4.6.nupkg


BIN
dist/jQuery.InputMask.2.4.7.nupkg


+ 38 - 42
dist/jquery.inputmask.bundle.js

@@ -3,7 +3,7 @@
 * http://github.com/RobinHerbots/jquery.inputmask
 * http://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2013 Robin Herbots
 * Copyright (c) 2010 - 2013 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 2.4.6
+* Version: 2.4.7
 */
 */
 
 
 (function ($) {
 (function ($) {
@@ -818,14 +818,14 @@
                     if (writeOut) input._valueSet(""); //initial clear
                     if (writeOut) input._valueSet(""); //initial clear
                     var ml = getMaskLength();
                     var ml = getMaskLength();
                     $.each(inputValue, function (ndx, charCode) {
                     $.each(inputValue, function (ndx, charCode) {
-                        if(intelliCheck === true) { 
-                        	var p = getActiveMaskSet()["p"], lvp = p == -1 ? p : seekPrevious(p),
+                        if (intelliCheck === true) {
+                            var p = getActiveMaskSet()["p"], lvp = p == -1 ? p : seekPrevious(p),
                         	pos = lvp == -1 ? ndx : seekNext(lvp);
                         	pos = lvp == -1 ? ndx : seekNext(lvp);
                             if ($.inArray(charCode, getActiveBufferTemplate().slice(lvp + 1, pos)) == -1) {
                             if ($.inArray(charCode, getActiveBufferTemplate().slice(lvp + 1, pos)) == -1) {
-                            	$(input).trigger("_keypress", [true, charCode.charCodeAt(0), writeOut, strict, ndx]);
-                        	}
+                                $(input).trigger("_keypress", [true, charCode.charCodeAt(0), writeOut, strict, ndx]);
+                            }
                         } else {
                         } else {
-                          	$(input).trigger("_keypress", [true, charCode.charCodeAt(0), writeOut, strict, ndx]);
+                            $(input).trigger("_keypress", [true, charCode.charCodeAt(0), writeOut, strict, ndx]);
                         }
                         }
                     });
                     });
 
 
@@ -985,7 +985,7 @@
                                 }
                                 }
                             });
                             });
                         }
                         }
-                        if (getMaskLength() > maxLength && maxLength > -1) { //FF sets no defined max length to -1 
+                        if (getMaskLength() >= maxLength && maxLength > -1) { //FF sets no defined max length to -1 
                             if (maxLength < getActiveBufferTemplate().length) getActiveBufferTemplate().length = maxLength;
                             if (maxLength < getActiveBufferTemplate().length) getActiveBufferTemplate().length = maxLength;
                             if (getActiveMaskSet()['greedy'] == false) {
                             if (getActiveMaskSet()['greedy'] == false) {
                                 getActiveMaskSet()['repeat'] = Math.round(maxLength / getActiveBufferTemplate().length);
                                 getActiveMaskSet()['repeat'] = Math.round(maxLength / getActiveBufferTemplate().length);
@@ -1296,15 +1296,12 @@
                                 var p = getBufferElement(buffer, j);
                                 var p = getBufferElement(buffer, j);
                                 if (p != getPlaceHolder(j)) {
                                 if (p != getPlaceHolder(j)) {
                                     if (j < getMaskLength() && isValid(i, p, true) !== false && getActiveTests()[determineTestPosition(i)].def == getActiveTests()[determineTestPosition(j)].def) {
                                     if (j < getMaskLength() && isValid(i, p, true) !== false && getActiveTests()[determineTestPosition(i)].def == getActiveTests()[determineTestPosition(j)].def) {
-                                        setBufferElement(buffer, i, getBufferElement(buffer, j), true);
-                                        if (j < end) {
-                                            setReTargetPlaceHolder(buffer, j); //cleanup next position
-                                        }
+                                        setBufferElement(buffer, i, p, true);
                                     } else {
                                     } else {
                                         if (isMask(i))
                                         if (isMask(i))
                                             break;
                                             break;
                                     }
                                     }
-                                } //else if (c == undefined) break;
+                                }
                             } else {
                             } else {
                                 setReTargetPlaceHolder(buffer, i);
                                 setReTargetPlaceHolder(buffer, i);
                             }
                             }
@@ -1323,30 +1320,25 @@
                         return start; //return the used start position
                         return start; //return the used start position
                     }
                     }
 
 
-                    function shiftR(start, end, c, full) { //full => behave like a push right ~ do not stop on placeholders
+                    function shiftR(start, end, c) {
                         var buffer = getActiveBuffer();
                         var buffer = getActiveBuffer();
-                        for (var i = start; i <= end && i < getMaskLength() ; i++) {
-                            if (isMask(i)) {
-                                var t = getBufferElement(buffer, i, true);
-                                setBufferElement(buffer, i, c, true);
-                                if (t != getPlaceHolder(i)) {
-                                    var j = seekNext(i);
-                                    if (j < getMaskLength()) {
-                                        if (isValid(j, t, true) !== false && getActiveTests()[determineTestPosition(i)].def == getActiveTests()[determineTestPosition(j)].def)
-                                            c = t;
-                                        else {
-                                            if (isMask(j))
-                                                break;
-                                            else c = t;
-                                        }
-                                    } else break;
-                                } else {
-                                    c = t;
-                                    if (full !== true) break;
-                                }
-                            } else
-                                setReTargetPlaceHolder(buffer, i);
+                        if (getBufferElement(buffer, start, true) != getPlaceHolder(start)) {
+                            for (var i = seekPrevious(end); i > start && i >= 0; i--) {
+                                if (isMask(i)) {
+                                    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) {
+                                            setBufferElement(buffer, i, t, true);
+                                            setReTargetPlaceHolder(buffer, j);
+                                        } else break;
+                                    }
+                                } else
+                                    setReTargetPlaceHolder(buffer, i);
+                            }
                         }
                         }
+                        if (c != undefined && getBufferElement(buffer, start) == getPlaceHolder(start))
+                            setBufferElement(buffer, start, c);
                         var lengthBefore = buffer.length;
                         var lengthBefore = buffer.length;
                         if (getActiveMaskSet()["greedy"] == false) {
                         if (getActiveMaskSet()["greedy"] == false) {
                             var trbuffer = truncateInput(buffer.join('')).split('');
                             var trbuffer = truncateInput(buffer.join('')).split('');
@@ -1514,7 +1506,7 @@
                                         $.each(masksets, function (ndx, lmnt) {
                                         $.each(masksets, function (ndx, lmnt) {
                                             if (typeof (lmnt) == "object") {
                                             if (typeof (lmnt) == "object") {
                                                 activeMasksetIndex = ndx;
                                                 activeMasksetIndex = ndx;
-                                                shiftR(pos.begin, getMaskLength(), getPlaceHolder(pos.begin), true);
+                                                shiftR(pos.begin, getMaskLength());
                                                 getActiveMaskSet()["lastValidPosition"] = seekNext(getActiveMaskSet()["lastValidPosition"]);
                                                 getActiveMaskSet()["lastValidPosition"] = seekNext(getActiveMaskSet()["lastValidPosition"]);
                                             }
                                             }
                                         });
                                         });
@@ -1557,7 +1549,7 @@
                                                     lastUnmaskedPosition = lastUnmaskedPosition == 0 ? -1 : seekPrevious(lastUnmaskedPosition);
                                                     lastUnmaskedPosition = lastUnmaskedPosition == 0 ? -1 : seekPrevious(lastUnmaskedPosition);
                                                 }
                                                 }
                                                 if (lastUnmaskedPosition >= p) {
                                                 if (lastUnmaskedPosition >= p) {
-                                                    shiftR(p, buffer.length, c);
+                                                    shiftR(p, getMaskLength(), c);
                                                     //shift the lvp if needed
                                                     //shift the lvp if needed
                                                     var lvp = getActiveMaskSet()["lastValidPosition"], nlvp = seekNext(lvp);
                                                     var lvp = getActiveMaskSet()["lastValidPosition"], nlvp = seekNext(lvp);
                                                     if (nlvp != getMaskLength() && lvp >= p && (getBufferElement(getActiveBuffer(), nlvp, true) != getPlaceHolder(nlvp))) {
                                                     if (nlvp != getMaskLength() && lvp >= p && (getBufferElement(getActiveBuffer(), nlvp, true) != getPlaceHolder(nlvp))) {
@@ -1647,7 +1639,11 @@
                                 valueOnFocus = getActiveBuffer().join('');
                                 valueOnFocus = getActiveBuffer().join('');
                             } else {
                             } else {
                                 writeBuffer(input, buffer);
                                 writeBuffer(input, buffer);
-                                caret(input, 0, getMaskLength());
+                                if (buffer.join('') == getActiveBufferTemplate().join('') && $.inArray(opts.radixPoint, buffer) != -1) {
+                                    caret(input, TranslatePosition(0));
+                                    $input.click();
+                                } else
+                                    caret(input, TranslatePosition(0), TranslatePosition(getMaskLength()));
                             }
                             }
                         }
                         }
                     }
                     }
@@ -1663,7 +1659,7 @@ Input Mask plugin extensions
 http://github.com/RobinHerbots/jquery.inputmask
 http://github.com/RobinHerbots/jquery.inputmask
 Copyright (c) 2010 - 2013 Robin Herbots
 Copyright (c) 2010 - 2013 Robin Herbots
 Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
 Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-Version: 2.4.6
+Version: 2.4.7
 
 
 Optional extensions on the jquery.inputmask base
 Optional extensions on the jquery.inputmask base
 */
 */
@@ -1785,7 +1781,7 @@ Input Mask plugin extensions
 http://github.com/RobinHerbots/jquery.inputmask
 http://github.com/RobinHerbots/jquery.inputmask
 Copyright (c) 2010 - 2012 Robin Herbots
 Copyright (c) 2010 - 2012 Robin Herbots
 Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
 Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-Version: 2.4.6
+Version: 2.4.7
 
 
 Optional extensions on the jquery.inputmask base
 Optional extensions on the jquery.inputmask base
 */
 */
@@ -2269,7 +2265,7 @@ Input Mask plugin extensions
 http://github.com/RobinHerbots/jquery.inputmask
 http://github.com/RobinHerbots/jquery.inputmask
 Copyright (c) 2010 - 2013 Robin Herbots
 Copyright (c) 2010 - 2013 Robin Herbots
 Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
 Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-Version: 2.4.6
+Version: 2.4.7
 
 
 Optional extensions on the jquery.inputmask base
 Optional extensions on the jquery.inputmask base
 */
 */
@@ -2446,7 +2442,7 @@ Input Mask plugin extensions
 http://github.com/RobinHerbots/jquery.inputmask
 http://github.com/RobinHerbots/jquery.inputmask
 Copyright (c) 2010 - 2013 Robin Herbots
 Copyright (c) 2010 - 2013 Robin Herbots
 Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
 Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-Version: 2.4.6
+Version: 2.4.7
 
 
 Regex extensions on the jquery.inputmask base
 Regex extensions on the jquery.inputmask base
 Allows for using regular expressions as a mask
 Allows for using regular expressions as a mask
@@ -2616,7 +2612,7 @@ Input Mask plugin extensions
 http://github.com/RobinHerbots/jquery.inputmask
 http://github.com/RobinHerbots/jquery.inputmask
 Copyright (c) 2010 - 2013 Robin Herbots
 Copyright (c) 2010 - 2013 Robin Herbots
 Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
 Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-Version: 2.4.6
+Version: 2.4.7
 
 
 Phone extension.
 Phone extension.
 When using this extension make sure you specify the correct url to get the masks
 When using this extension make sure you specify the correct url to get the masks

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


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


+ 1 - 1
jquery.inputmask.jquery.json

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

+ 11 - 0
qunit/tests.js

@@ -938,6 +938,17 @@ test("inputmask(\"mm/yyyy\") - input 31973", function () {
     $("#testmask").remove();
     $("#testmask").remove();
 });
 });
 
 
+test("inputmask(\"mm/dd/yyyy\") - select some input 1 - Guamaso", function () {
+    $('body').append('<input type="text" id="testmask" />');
+    $("#testmask").inputmask("mm/dd/yyyy");
+
+    $("#testmask")[0].focus();
+	caret($("#testmask")[0], 0, 5);
+    $("#testmask").Type("1");
+    equal($("#testmask").val(), "1m/dd/yyyy", "Result " + $("#testmask").val());
+    $("#testmask").remove();
+});
+
 module("Numeric.Extensions");
 module("Numeric.Extensions");
 test("inputmask(\"decimal\", { autoGroup: true, groupSeparator: \",\" }\") - input 12345.123", function () {
 test("inputmask(\"decimal\", { autoGroup: true, groupSeparator: \",\" }\") - input 12345.123", function () {
     $('body').append('<input type="text" id="testmask" />');
     $('body').append('<input type="text" id="testmask" />');