浏览代码

Merge branch '1.x' into 2.x

Robin Herbots 13 年之前
父节点
当前提交
926c32b5fc

+ 1 - 1
build.properties

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

+ 20 - 11
dist/jquery.inputmask.bundle.js

@@ -3,7 +3,7 @@
 * http://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2013 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 2.1.10
+* Version: 2.1.11
 */
 
 (function ($) {
@@ -78,12 +78,14 @@
             var pasteEvent = isInputEventSupported('paste') ? 'paste' : 'input';
 
             var iphone = navigator.userAgent.match(/iphone/i) != null;
-            var android = navigator.userAgent.match(/android.*mobile safari.*/i) != null;
-            //if (android) {
-            //    var browser = navigator.userAgent.match(/mobile safari.*/i);
-            //    var version = parseInt(new RegExp(/[0-9]+/).exec(browser));
-            //    android = version <= 533;
-            //}
+            var android = navigator.userAgent.match(/android.*safari.*/i) != null,
+	    	android534;
+            if (android) {
+                var browser = navigator.userAgent.match(/safari.*/i);
+                var version = parseInt(new RegExp(/[0-9]+/).exec(browser));
+                android = (version <= 533);
+                android534 = (533 < version <= 534);
+            }
             var caretposCorrection = null;
             var masksets,
 	        activeMasksetIndex = 0;
@@ -663,7 +665,14 @@
                     end = (typeof end == 'number') ? end : begin;
                     if (opts.insertMode == false && begin == end) end++; //set visualization for insert/overwrite mode
                     if (npt.setSelectionRange) {
-                        npt.setSelectionRange(begin, end);
+                        if (end == begin) {
+                       		npt.focus();
+                        	npt.setSelectionRange(begin, end);
+                    	} else {
+                        	npt.select();
+                        	npt.selectionStart = begin;
+                        	npt.selectionEnd = android534 ? begin : end;
+                    	}
                     } else if (npt.createTextRange) {
                         var range = npt.createTextRange();
                         range.collapse(true);
@@ -1267,7 +1276,7 @@ Input Mask plugin extensions
 http://github.com/RobinHerbots/jquery.inputmask
 Copyright (c) 2010 - 2013 Robin Herbots
 Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-Version: 2.1.10
+Version: 2.1.11
 
 Optional extensions on the jquery.inputmask base
 */
@@ -1364,7 +1373,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: 2.1.10
+Version: 2.1.11
 
 Optional extensions on the jquery.inputmask base
 */
@@ -1857,7 +1866,7 @@ Input Mask plugin extensions
 http://github.com/RobinHerbots/jquery.inputmask
 Copyright (c) 2010 - 2013 Robin Herbots
 Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-Version: 2.1.10
+Version: 2.1.11
 
 Optional extensions on the jquery.inputmask base
 */

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


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


+ 1 - 1
jquery.inputmask.jquery.json

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

+ 16 - 7
js/jquery.inputmask.js

@@ -78,12 +78,14 @@
             var pasteEvent = isInputEventSupported('paste') ? 'paste' : 'input';
 
             var iphone = navigator.userAgent.match(/iphone/i) != null;
-            var android = navigator.userAgent.match(/android.*mobile safari.*/i) != null;
-            //if (android) {
-            //    var browser = navigator.userAgent.match(/mobile safari.*/i);
-            //    var version = parseInt(new RegExp(/[0-9]+/).exec(browser));
-            //    android = version <= 533;
-            //}
+            var android = navigator.userAgent.match(/android.*safari.*/i) != null,
+	    	android534;
+            if (android) {
+                var browser = navigator.userAgent.match(/safari.*/i);
+                var version = parseInt(new RegExp(/[0-9]+/).exec(browser));
+                android = (version <= 533);
+                android534 = (533 < version <= 534);
+            }
             var caretposCorrection = null;
             var masksets,
 	        activeMasksetIndex = 0;
@@ -663,7 +665,14 @@
                     end = (typeof end == 'number') ? end : begin;
                     if (opts.insertMode == false && begin == end) end++; //set visualization for insert/overwrite mode
                     if (npt.setSelectionRange) {
-                        npt.setSelectionRange(begin, end);
+                        if (end == begin) {
+                       		npt.focus();
+                        	npt.setSelectionRange(begin, end);
+                    	} else {
+                        	npt.select();
+                        	npt.selectionStart = begin;
+                        	npt.selectionEnd = android534 ? begin : end;
+                    	}
                     } else if (npt.createTextRange) {
                         var range = npt.createTextRange();
                         range.collapse(true);