浏览代码

fix paste event

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

+ 1 - 1
bower.json

@@ -1,6 +1,6 @@
 {
 {
     "name": "jquery.inputmask",
     "name": "jquery.inputmask",
-    "version": "2.4.29",
+    "version": "2.4.30",
     "main": "./dist/jquery.inputmask.bundle.js",
     "main": "./dist/jquery.inputmask.bundle.js",
 	"keywords" : ["jQuery", "plugins", "input", "form", "inputmask", "mask"],
 	"keywords" : ["jQuery", "plugins", "input", "form", "inputmask", "mask"],
 	"description": "jquery.inputmask is a jquery plugin which create an input 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.major = 2
 build.minor = 4
 build.minor = 4
-build.revision = 29
+build.revision = 30
 
 
 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.4.29.nupkg


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


+ 10 - 10
dist/jquery.inputmask.bundle.js

@@ -3,7 +3,7 @@
 * http://github.com/RobinHerbots/jquery.inputmask
 * http://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2014 Robin Herbots
 * Copyright (c) 2010 - 2014 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.29
+* Version: 2.4.30
 */
 */
 
 
 (function ($) {
 (function ($) {
@@ -618,7 +618,7 @@
                 if (typeof begin == 'number') {
                 if (typeof begin == 'number') {
                     begin = TranslatePosition(begin);
                     begin = TranslatePosition(begin);
                     end = TranslatePosition(end);
                     end = TranslatePosition(end);
-                    if (!$(input).is(':visible')) {
+                    if (!$(npt).is(':visible')) {
                         return;
                         return;
                     }
                     }
                     end = (typeof end == 'number') ? end : begin;
                     end = (typeof end == 'number') ? end : begin;
@@ -1161,12 +1161,12 @@
             }
             }
 
 
             function pasteEvent(e) {
             function pasteEvent(e) {
-                if (skipInputEvent === true) {
+                if (skipInputEvent === true && e.type == "input") {
                     skipInputEvent = false;
                     skipInputEvent = false;
                     return true;
                     return true;
                 }
                 }
-                var input = this, $input = $(input);
 
 
+                var input = this, $input = $(input);
                 //paste event for IE8 and lower I guess ;-)
                 //paste event for IE8 and lower I guess ;-)
                 if (e.type == "propertychange" && input._valueGet().length <= getMaskLength()) {
                 if (e.type == "propertychange" && input._valueGet().length <= getMaskLength()) {
                     return true;
                     return true;
@@ -1377,7 +1377,6 @@
                          ).bind("keypress.inputmask", keypressEvent
                          ).bind("keypress.inputmask", keypressEvent
                          ).bind("keyup.inputmask", keyupEvent);
                          ).bind("keyup.inputmask", keyupEvent);
 
 
-
                     if (android) {
                     if (android) {
                         if (androidchrome) {
                         if (androidchrome) {
                             $el.bind("input.inputmask", mobileInputEvent);
                             $el.bind("input.inputmask", mobileInputEvent);
@@ -1391,6 +1390,7 @@
                         }
                         }
                         $el.bind("input.inputmask", mobileInputEvent);
                         $el.bind("input.inputmask", mobileInputEvent);
                     }
                     }
+
                     if (msie1x)
                     if (msie1x)
                         $el.bind("input.inputmask", pasteEvent);
                         $el.bind("input.inputmask", pasteEvent);
 
 
@@ -1688,7 +1688,7 @@ Input Mask plugin extensions
 http://github.com/RobinHerbots/jquery.inputmask
 http://github.com/RobinHerbots/jquery.inputmask
 Copyright (c) 2010 - 2014 Robin Herbots
 Copyright (c) 2010 - 2014 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.29
+Version: 2.4.30
 
 
 Optional extensions on the jquery.inputmask base
 Optional extensions on the jquery.inputmask base
 */
 */
@@ -1810,7 +1810,7 @@ Input Mask plugin extensions
 http://github.com/RobinHerbots/jquery.inputmask
 http://github.com/RobinHerbots/jquery.inputmask
 Copyright (c) 2010 - 2014 Robin Herbots
 Copyright (c) 2010 - 2014 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.29
+Version: 2.4.30
 
 
 Optional extensions on the jquery.inputmask base
 Optional extensions on the jquery.inputmask base
 */
 */
@@ -2298,7 +2298,7 @@ Input Mask plugin extensions
 http://github.com/RobinHerbots/jquery.inputmask
 http://github.com/RobinHerbots/jquery.inputmask
 Copyright (c) 2010 - 2014 Robin Herbots
 Copyright (c) 2010 - 2014 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.29
+Version: 2.4.30
 
 
 Optional extensions on the jquery.inputmask base
 Optional extensions on the jquery.inputmask base
 */
 */
@@ -2475,7 +2475,7 @@ Input Mask plugin extensions
 http://github.com/RobinHerbots/jquery.inputmask
 http://github.com/RobinHerbots/jquery.inputmask
 Copyright (c) 2010 - 2014 Robin Herbots
 Copyright (c) 2010 - 2014 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.29
+Version: 2.4.30
 
 
 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
@@ -2645,7 +2645,7 @@ Input Mask plugin extensions
 http://github.com/RobinHerbots/jquery.inputmask
 http://github.com/RobinHerbots/jquery.inputmask
 Copyright (c) 2010 - 2014 Robin Herbots
 Copyright (c) 2010 - 2014 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.29
+Version: 2.4.30
 
 
 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

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


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


+ 1 - 1
jquery.inputmask.jquery.json

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

+ 4 - 4
js/jquery.inputmask.js

@@ -618,7 +618,7 @@
                 if (typeof begin == 'number') {
                 if (typeof begin == 'number') {
                     begin = TranslatePosition(begin);
                     begin = TranslatePosition(begin);
                     end = TranslatePosition(end);
                     end = TranslatePosition(end);
-                    if (!$(input).is(':visible')) {
+                    if (!$(npt).is(':visible')) {
                         return;
                         return;
                     }
                     }
                     end = (typeof end == 'number') ? end : begin;
                     end = (typeof end == 'number') ? end : begin;
@@ -1161,12 +1161,12 @@
             }
             }
 
 
             function pasteEvent(e) {
             function pasteEvent(e) {
-                if (skipInputEvent === true) {
+                if (skipInputEvent === true && e.type == "input") {
                     skipInputEvent = false;
                     skipInputEvent = false;
                     return true;
                     return true;
                 }
                 }
-                var input = this, $input = $(input);
 
 
+                var input = this, $input = $(input);
                 //paste event for IE8 and lower I guess ;-)
                 //paste event for IE8 and lower I guess ;-)
                 if (e.type == "propertychange" && input._valueGet().length <= getMaskLength()) {
                 if (e.type == "propertychange" && input._valueGet().length <= getMaskLength()) {
                     return true;
                     return true;
@@ -1377,7 +1377,6 @@
                          ).bind("keypress.inputmask", keypressEvent
                          ).bind("keypress.inputmask", keypressEvent
                          ).bind("keyup.inputmask", keyupEvent);
                          ).bind("keyup.inputmask", keyupEvent);
 
 
-
                     if (android) {
                     if (android) {
                         if (androidchrome) {
                         if (androidchrome) {
                             $el.bind("input.inputmask", mobileInputEvent);
                             $el.bind("input.inputmask", mobileInputEvent);
@@ -1391,6 +1390,7 @@
                         }
                         }
                         $el.bind("input.inputmask", mobileInputEvent);
                         $el.bind("input.inputmask", mobileInputEvent);
                     }
                     }
+
                     if (msie1x)
                     if (msie1x)
                         $el.bind("input.inputmask", pasteEvent);
                         $el.bind("input.inputmask", pasteEvent);