浏览代码

fix setvalue

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

+ 1 - 1
bower.json

@@ -1,6 +1,6 @@
 {
   "name": "jquery.inputmask",
-  "version": "3.0.55",
+  "version": "3.0.56",
   "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 = 3
 build.minor = 0
-build.revision = 55
+build.revision = 56
 
 target = jquery.inputmask.bundle.js
 target.min = jquery.inputmask.bundle.min.js

+ 22 - 25
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: 3.0.55
+* Version: 3.0.56
 */
 
 (function ($) {
@@ -1384,9 +1384,7 @@
                     ).bind('setvalue.inputmask', function () {
                         var input = this;
                         checkVal(input, true);
-                        valueOnFocus = getBuffer().join('');
-                        if (input._valueGet() == getBufferTemplate().join(''))
-                            input._valueSet('');
+                        valueOnFocus = getBuffer().join('');
                     }).bind('complete.inputmask', opts.oncomplete
                     ).bind('incomplete.inputmask', opts.onincomplete
                     ).bind('cleared.inputmask', opts.oncleared);
@@ -1415,23 +1413,22 @@
                         activeElement = document.activeElement;
                     } catch (e) {
                     }
+                    if (isComplete(getBuffer()) === false) {
+                        if (opts.clearIncomplete)
+                            resetMaskSet();
+                    }
+                    if (opts.clearMaskOnLostFocus) {
+                        if (getBuffer().join('') == getBufferTemplate().join('')) {
+                            el._valueSet('');
+                        } else {
+                            clearOptionalTail(el);
+                        }
+                    } else {
+                        writeBuffer(el, getBuffer());
+                    }
                     if (activeElement === el) { //position the caret when in focus
                         $el.addClass('focus-inputmask');
                         caret(el, seekNext(getLastValidPosition()));
-                    } else {
-                        if (isComplete(getBuffer()) === false) {
-                            if (opts.clearIncomplete)
-                                resetMaskSet();
-                        }
-                        if (opts.clearMaskOnLostFocus) {
-                            if (getBuffer().join('') == getBufferTemplate().join('')) {
-                                el._valueSet('');
-                            } else {
-                                clearOptionalTail(el);
-                            }
-                        } else {
-                            writeBuffer(el, getBuffer());
-                        }
                     }
 
                     installEventRuler(el);
@@ -1726,7 +1723,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: 3.0.55
+* Version: 3.0.56
 */
 
 (function ($) {
@@ -2089,7 +2086,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: 3.0.55
+Version: 3.0.56
 
 Optional extensions on the jquery.inputmask base
 */
@@ -2210,7 +2207,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: 3.0.55
+Version: 3.0.56
 
 Optional extensions on the jquery.inputmask base
 */
@@ -2698,7 +2695,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: 3.0.55
+Version: 3.0.56
 
 Optional extensions on the jquery.inputmask base
 */
@@ -2747,7 +2744,7 @@ Optional extensions on the jquery.inputmask base
             prefix: "",
             suffix: "",
             rightAlign: true,
-            postFormat: function (buffer, pos, reformatOnly, opts) {
+            postFormat: function (buffer, pos, reformatOnly, opts) {  //this needs to be removed // this is crap
                 var needsRefresh = false, charAtPos = buffer[pos];
                 if (opts.groupSeparator == "" ||
                     ($.inArray(opts.radixPoint, buffer) != -1 && pos >= $.inArray(opts.radixPoint, buffer)) ||
@@ -2942,7 +2939,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: 3.0.55
+Version: 3.0.56
 
 Regex extensions on the jquery.inputmask base
 Allows for using regular expressions as a mask
@@ -3129,7 +3126,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: 3.0.55
+Version: 3.0.56
 
 Phone extension.
 When using this extension make sure you specify the correct url to get the masks

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


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


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


+ 1 - 1
jquery.inputmask.jquery.json

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

+ 14 - 17
js/jquery.inputmask.js

@@ -1384,9 +1384,7 @@
                     ).bind('setvalue.inputmask', function () {
                         var input = this;
                         checkVal(input, true);
-                        valueOnFocus = getBuffer().join('');
-                        if (input._valueGet() == getBufferTemplate().join(''))
-                            input._valueSet('');
+                        valueOnFocus = getBuffer().join('');
                     }).bind('complete.inputmask', opts.oncomplete
                     ).bind('incomplete.inputmask', opts.onincomplete
                     ).bind('cleared.inputmask', opts.oncleared);
@@ -1415,23 +1413,22 @@
                         activeElement = document.activeElement;
                     } catch (e) {
                     }
+                    if (isComplete(getBuffer()) === false) {
+                        if (opts.clearIncomplete)
+                            resetMaskSet();
+                    }
+                    if (opts.clearMaskOnLostFocus) {
+                        if (getBuffer().join('') == getBufferTemplate().join('')) {
+                            el._valueSet('');
+                        } else {
+                            clearOptionalTail(el);
+                        }
+                    } else {
+                        writeBuffer(el, getBuffer());
+                    }
                     if (activeElement === el) { //position the caret when in focus
                         $el.addClass('focus-inputmask');
                         caret(el, seekNext(getLastValidPosition()));
-                    } else {
-                        if (isComplete(getBuffer()) === false) {
-                            if (opts.clearIncomplete)
-                                resetMaskSet();
-                        }
-                        if (opts.clearMaskOnLostFocus) {
-                            if (getBuffer().join('') == getBufferTemplate().join('')) {
-                                el._valueSet('');
-                            } else {
-                                clearOptionalTail(el);
-                            }
-                        } else {
-                            writeBuffer(el, getBuffer());
-                        }
                     }
 
                     installEventRuler(el);

+ 1 - 1
js/jquery.inputmask.numeric.extensions.js

@@ -52,7 +52,7 @@ Optional extensions on the jquery.inputmask base
             prefix: "",
             suffix: "",
             rightAlign: true,
-            postFormat: function (buffer, pos, reformatOnly, opts) {
+            postFormat: function (buffer, pos, reformatOnly, opts) {  //this needs to be removed // this is crap
                 var needsRefresh = false, charAtPos = buffer[pos];
                 if (opts.groupSeparator == "" ||
                     ($.inArray(opts.radixPoint, buffer) != -1 && pos >= $.inArray(opts.radixPoint, buffer)) ||