浏览代码

cleanup mask when switching masks

Robin Herbots 12 年之前
父节点
当前提交
f27a2b7067

+ 1 - 1
build.properties

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

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


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


+ 13 - 7
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.2.27
+* Version: 2.2.28
 */
 */
 
 
 (function ($) {
 (function ($) {
@@ -498,8 +498,14 @@
                     }
                     }
                 });
                 });
                 activeMasksetIndex = highestValid["activeMasksetIndex"];
                 activeMasksetIndex = highestValid["activeMasksetIndex"];
-                if (currentMasksetIndex != activeMasksetIndex)
+                if (currentMasksetIndex != activeMasksetIndex) {
+                    if (isRTL) {
+                        clearBuffer(getActiveBuffer(), 0, seekPrevious(highestValid["lastValidPosition"]));
+                    } else {
+                        clearBuffer(getActiveBuffer(), seekNext(highestValid["lastValidPosition"]), getMaskLength());
+                    }
                     getActiveMaskSet()["writeOutBuffer"] = true;
                     getActiveMaskSet()["writeOutBuffer"] = true;
+                }
             }
             }
 
 
             function isMask(pos) {
             function isMask(pos) {
@@ -1025,7 +1031,7 @@
                 //shift chars to left from start to end and put c at end position if defined
                 //shift chars to left from start to end and put c at end position if defined
                 function shiftL(start, end, c) {
                 function shiftL(start, end, c) {
                     var buffer = getActiveBuffer();
                     var buffer = getActiveBuffer();
-                    while (!isMask(start) && start - 1 >= 0) start--;
+                    while (!isMask(start) && start - 1 >= 0) start--; //jumping over nonmask position
                     for (var i = start; i < end && i < getMaskLength() ; i++) {
                     for (var i = start; i < end && i < getMaskLength() ; i++) {
                         if (isMask(i)) {
                         if (isMask(i)) {
                             setReTargetPlaceHolder(buffer, i);
                             setReTargetPlaceHolder(buffer, i);
@@ -1437,7 +1443,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.2.27
+Version: 2.2.28
 
 
 Optional extensions on the jquery.inputmask base
 Optional extensions on the jquery.inputmask base
 */
 */
@@ -1534,7 +1540,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.2.27
+Version: 2.2.28
 
 
 Optional extensions on the jquery.inputmask base
 Optional extensions on the jquery.inputmask base
 */
 */
@@ -2027,7 +2033,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.2.27
+Version: 2.2.28
 
 
 Optional extensions on the jquery.inputmask base
 Optional extensions on the jquery.inputmask base
 */
 */
@@ -2186,7 +2192,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.2.27
+Version: 2.2.28
 
 
 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

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


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


+ 1 - 1
jquery.inputmask.jquery.json

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

+ 8 - 2
js/jquery.inputmask.js

@@ -498,8 +498,14 @@
                     }
                     }
                 });
                 });
                 activeMasksetIndex = highestValid["activeMasksetIndex"];
                 activeMasksetIndex = highestValid["activeMasksetIndex"];
-                if (currentMasksetIndex != activeMasksetIndex)
+                if (currentMasksetIndex != activeMasksetIndex) {
+                    if (isRTL) {
+                        clearBuffer(getActiveBuffer(), 0, seekPrevious(highestValid["lastValidPosition"]));
+                    } else {
+                        clearBuffer(getActiveBuffer(), seekNext(highestValid["lastValidPosition"]), getMaskLength());
+                    }
                     getActiveMaskSet()["writeOutBuffer"] = true;
                     getActiveMaskSet()["writeOutBuffer"] = true;
+                }
             }
             }
 
 
             function isMask(pos) {
             function isMask(pos) {
@@ -1025,7 +1031,7 @@
                 //shift chars to left from start to end and put c at end position if defined
                 //shift chars to left from start to end and put c at end position if defined
                 function shiftL(start, end, c) {
                 function shiftL(start, end, c) {
                     var buffer = getActiveBuffer();
                     var buffer = getActiveBuffer();
-                    while (!isMask(start) && start - 1 >= 0) start--;
+                    while (!isMask(start) && start - 1 >= 0) start--; //jumping over nonmask position
                     for (var i = start; i < end && i < getMaskLength() ; i++) {
                     for (var i = start; i < end && i < getMaskLength() ; i++) {
                         if (isMask(i)) {
                         if (isMask(i)) {
                             setReTargetPlaceHolder(buffer, i);
                             setReTargetPlaceHolder(buffer, i);