Browse Source

Fix for android 2.3.x Safari/533

Robin Herbots 12 years ago
parent
commit
f7fc90c981

+ 1 - 1
build.properties

@@ -7,7 +7,7 @@ distdir = dist
 
 build.major = 1
 build.minor = 3
-build.revision = 16
+build.revision = 17
 
 target = jquery.inputmask.bundle.js
 target.min = jquery.inputmask.bundle.min.js

+ 12 - 13
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: 1.3.16
+* Version: 1.3.17
 */
 
 (function ($) {
@@ -78,13 +78,13 @@
 
             var iphone = navigator.userAgent.match(/iphone/i) != null;
             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) && (version <= 534);
-            //}
+	    	android533;
+            if (android) {
+                var browser = navigator.userAgent.match(/safari.*/i);
+                var version = parseInt(new RegExp(/[0-9]+/).exec(browser));
+                android533 = (version <= 533);
+                //android534 = (533 < version) && (version <= 534);
+            }
             if (typeof fn == "string") {
                 switch (fn) {
                     case "mask":
@@ -563,7 +563,7 @@
                         return { "begin": 0, "end": 0 };
                     }
                     if (npt.setSelectionRange) {
-                        begin = npt.selectionStart;
+                        begin = android533 ? npt.selectionEnd : npt.selectionStart;
                         end = npt.selectionEnd;
                     } else if (document.selection && document.selection.createRange) {
                         var range = document.selection.createRange();
@@ -1090,7 +1090,6 @@
                                 }
                             }
                             if(android) {
-                    			console.log("restore " + caretSavePoint.begin + ' ' + caretSavePoint.end);
                    		 		caret(input, caretSavePoint.begin, caretSavePoint.end);
                   			}
                             e.preventDefault();
@@ -1120,7 +1119,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: 1.3.16
+Version: 1.3.17
 
 Optional extensions on the jquery.inputmask base
 */
@@ -1217,7 +1216,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.16
+Version: 1.3.17
 
 Optional extensions on the jquery.inputmask base
 */
@@ -1710,7 +1709,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: 1.3.16
+Version: 1.3.17
 
 Optional extensions on the jquery.inputmask base
 */

File diff suppressed because it is too large
+ 46 - 46
dist/jquery.inputmask.bundle.min.js


File diff suppressed because it is too large
+ 30 - 30
dist/min/jquery.inputmask.js


+ 1 - 1
jquery.inputmask.jquery.json

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

+ 8 - 8
js/jquery.inputmask.js

@@ -78,13 +78,13 @@
 
             var iphone = navigator.userAgent.match(/iphone/i) != null;
             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) && (version <= 534);
-            //}
+	    	android533;
+            if (android) {
+                var browser = navigator.userAgent.match(/safari.*/i);
+                var version = parseInt(new RegExp(/[0-9]+/).exec(browser));
+                android533 = (version <= 533);
+                //android534 = (533 < version) && (version <= 534);
+            }
             if (typeof fn == "string") {
                 switch (fn) {
                     case "mask":
@@ -563,7 +563,7 @@
                         return { "begin": 0, "end": 0 };
                     }
                     if (npt.setSelectionRange) {
-                        begin = npt.selectionStart;
+                        begin = android533 ? npt.selectionEnd : npt.selectionStart;
                         end = npt.selectionEnd;
                     } else if (document.selection && document.selection.createRange) {
                         var range = document.selection.createRange();