ソースを参照

Caret may be undefined if input isnt visible

Robin Herbots 13 年 前
コミット
7bcc3aba25

+ 1 - 1
build.properties

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

+ 1 - 1
build.xml

@@ -14,7 +14,7 @@
 	   <replaceregexp file="${srcdir}/jquery.inputmask.extensions.js" match="Version:.*" replace="Version: ${build.major}.${build.minor}.${build.revision}"  byline="true"/>
 	   <replaceregexp file="${srcdir}/jquery.inputmask.extensions.js" match="Version:.*" replace="Version: ${build.major}.${build.minor}.${build.revision}"  byline="true"/>
 	   <replaceregexp file="${srcdir}/jquery.inputmask.date.extensions.js" match="Version:.*" replace="Version: ${build.major}.${build.minor}.${build.revision}"  byline="true"/>
 	   <replaceregexp file="${srcdir}/jquery.inputmask.date.extensions.js" match="Version:.*" replace="Version: ${build.major}.${build.minor}.${build.revision}"  byline="true"/>
 	   <replaceregexp file="${srcdir}/jquery.inputmask.numeric.extensions.js" match="Version:.*" replace="Version: ${build.major}.${build.minor}.${build.revision}"  byline="true"/>
 	   <replaceregexp file="${srcdir}/jquery.inputmask.numeric.extensions.js" match="Version:.*" replace="Version: ${build.major}.${build.minor}.${build.revision}"  byline="true"/>
-	   <replaceregexp file="./jquery.inputmask.jquery.json" match="&quot;version&quot;:.*" replace="&quot;version&quot;: &quot;${build.major}.${build.minor}.${build.revision}&quot;"  byline="true"/>
+	   <replaceregexp file="./jquery.inputmask.jquery.json" match="&quot;version&quot;:.*" replace="&quot;version&quot;: &quot;${build.major}.${build.minor}.${build.revision}&quot;,"  byline="true"/>
 	</target>
 	</target>
 
 
 	<target name="resetVersions">
 	<target name="resetVersions">

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

@@ -3,7 +3,7 @@
 * http://github.com/RobinHerbots/jquery.inputmask
 * http://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2013 Robin Herbots
 * Copyright (c) 2010 - 2013 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: 1.3.10
+* Version: 1.3.11
 */
 */
 
 
 (function ($) {
 (function ($) {
@@ -535,12 +535,12 @@
                 }
                 }
             }
             }
 
 
-            function caret(input, begin, end) {
-                if (!$(input).is(':visible')) {
-                    return;
-                }
+            function caret(input, begin, end) {       
                 var npt = input.jquery && input.length > 0 ? input[0] : input;
                 var npt = input.jquery && input.length > 0 ? input[0] : input;
                 if (typeof begin == 'number') {
                 if (typeof begin == 'number') {
+                  	if (!$(input).is(':visible')) {
+                    	return;
+                	}
                     end = (typeof end == 'number') ? end : begin;
                     end = (typeof end == 'number') ? end : begin;
                     if (opts.insertMode == false && begin == end) end++; //set visualization for insert/overwrite mode
                     if (opts.insertMode == false && begin == end) end++; //set visualization for insert/overwrite mode
                     if (npt.setSelectionRange) {
                     if (npt.setSelectionRange) {
@@ -555,6 +555,9 @@
                     npt.focus();
                     npt.focus();
                     if (android && end != npt.selectionEnd) caretposCorrection = { begin: begin, end: end };
                     if (android && end != npt.selectionEnd) caretposCorrection = { begin: begin, end: end };
                 } else {
                 } else {
+                	if (!$(input).is(':visible')) {
+                    	return { begin: 0, end: 0 };
+                	}
                     var caretpos = android ? caretposCorrection : null, caretposCorrection = null;
                     var caretpos = android ? caretposCorrection : null, caretposCorrection = null;
                     if (caretpos == null) {
                     if (caretpos == null) {
                         if (npt.setSelectionRange) {
                         if (npt.setSelectionRange) {
@@ -1115,7 +1118,7 @@ Input Mask plugin extensions
 http://github.com/RobinHerbots/jquery.inputmask
 http://github.com/RobinHerbots/jquery.inputmask
 Copyright (c) 2010 - 2013 Robin Herbots
 Copyright (c) 2010 - 2013 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: 1.3.10
+Version: 1.3.11
 
 
 Optional extensions on the jquery.inputmask base
 Optional extensions on the jquery.inputmask base
 */
 */
@@ -1212,7 +1215,7 @@ Input Mask plugin extensions
 http://github.com/RobinHerbots/jquery.inputmask
 http://github.com/RobinHerbots/jquery.inputmask
 Copyright (c) 2010 - 2012 Robin Herbots
 Copyright (c) 2010 - 2012 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: 1.3.10
+Version: 1.3.11
 
 
 Optional extensions on the jquery.inputmask base
 Optional extensions on the jquery.inputmask base
 */
 */
@@ -1705,7 +1708,7 @@ Input Mask plugin extensions
 http://github.com/RobinHerbots/jquery.inputmask
 http://github.com/RobinHerbots/jquery.inputmask
 Copyright (c) 2010 - 2013 Robin Herbots
 Copyright (c) 2010 - 2013 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: 1.3.10
+Version: 1.3.11
 
 
 Optional extensions on the jquery.inputmask base
 Optional extensions on the jquery.inputmask base
 */
 */

ファイルの差分が大きいため隠しています
+ 23 - 23
dist/jquery.inputmask.bundle.min.js


ファイルの差分が大きいため隠しています
+ 32 - 32
dist/min/jquery.inputmask.js


+ 1 - 1
jquery.inputmask.jquery.json

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

+ 7 - 4
js/jquery.inputmask.js

@@ -535,12 +535,12 @@
                 }
                 }
             }
             }
 
 
-            function caret(input, begin, end) {
-                if (!$(input).is(':visible')) {
-                    return;
-                }
+            function caret(input, begin, end) {       
                 var npt = input.jquery && input.length > 0 ? input[0] : input;
                 var npt = input.jquery && input.length > 0 ? input[0] : input;
                 if (typeof begin == 'number') {
                 if (typeof begin == 'number') {
+                  	if (!$(input).is(':visible')) {
+                    	return;
+                	}
                     end = (typeof end == 'number') ? end : begin;
                     end = (typeof end == 'number') ? end : begin;
                     if (opts.insertMode == false && begin == end) end++; //set visualization for insert/overwrite mode
                     if (opts.insertMode == false && begin == end) end++; //set visualization for insert/overwrite mode
                     if (npt.setSelectionRange) {
                     if (npt.setSelectionRange) {
@@ -555,6 +555,9 @@
                     npt.focus();
                     npt.focus();
                     if (android && end != npt.selectionEnd) caretposCorrection = { begin: begin, end: end };
                     if (android && end != npt.selectionEnd) caretposCorrection = { begin: begin, end: end };
                 } else {
                 } else {
+                	if (!$(input).is(':visible')) {
+                    	return { begin: 0, end: 0 };
+                	}
                     var caretpos = android ? caretposCorrection : null, caretposCorrection = null;
                     var caretpos = android ? caretposCorrection : null, caretposCorrection = null;
                     if (caretpos == null) {
                     if (caretpos == null) {
                         if (npt.setSelectionRange) {
                         if (npt.setSelectionRange) {