|
|
@@ -3,7 +3,7 @@ Input Mask plugin extensions
|
|
|
http://github.com/RobinHerbots/jquery.inputmask
|
|
|
Copyright (c) 2010 - 2012 Robin Herbots
|
|
|
Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
|
|
|
-Version: 1.3.2
|
|
|
+Version: 1.3.3
|
|
|
|
|
|
Optional extensions on the jquery.inputmask base
|
|
|
*/
|
|
|
@@ -77,15 +77,17 @@ Optional extensions on the jquery.inputmask base
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- //grouping
|
|
|
- if (opts.autoGroup && isValid != false && !strict) {
|
|
|
+
|
|
|
+ if (isValid != false && !strict) {
|
|
|
var cbuf = buffer.slice();
|
|
|
cbuf.splice(pos, 0, "?"); //set position indicator
|
|
|
var bufVal = cbuf.join('');
|
|
|
- bufVal = bufVal.replace(new RegExp("\\" + opts.groupSeparator, "g"), '');
|
|
|
- var reg = new RegExp('(-?[\\d?]+)([\\d?]{' + opts.groupSize + '})');
|
|
|
- while (reg.test(bufVal)) {
|
|
|
- bufVal = bufVal.replace(reg, '$1' + opts.groupSeparator + '$2');
|
|
|
+ if (opts.autoGroup || bufVal.indexOf(opts.groupSeparator) != -1) {
|
|
|
+ bufVal = bufVal.replace(new RegExp("\\" + opts.groupSeparator, "g"), '');
|
|
|
+ var reg = new RegExp('(-?[\\d?]+)([\\d?]{' + opts.groupSize + '})');
|
|
|
+ while (reg.test(bufVal)) {
|
|
|
+ bufVal = bufVal.replace(reg, '$1' + opts.groupSeparator + '$2');
|
|
|
+ }
|
|
|
}
|
|
|
buffer.length = bufVal.length; //align the length
|
|
|
for (var i = 0, l = bufVal.length; i < l; i++) {
|