ソースを参照

fix determinelastrequiredposition

Robin Herbots 10 年 前
コミット
dfd07411cb

+ 1 - 0
CHANGELOG.md

@@ -7,6 +7,7 @@ All notable changes to this project will be documented in this file.
 
 
 ### Updates
 ### Updates
 - Make alternators correctly handle alternations with different lengths
 - Make alternators correctly handle alternations with different lengths
+- better determine the last required position with multiple masks
 
 
 ### Fixed
 ### Fixed
 - masking a password field #821 (reenable type=password)
 - masking a password field #821 (reenable type=password)

+ 1 - 0
README.md

@@ -441,6 +441,7 @@ Default: false
 #### clearMaskOnLostFocus
 #### clearMaskOnLostFocus
 
 
 Remove the empty mask on blur or when not empty removes the optional trailing part
 Remove the empty mask on blur or when not empty removes the optional trailing part
+Default: true
 
 
 ```javascript
 ```javascript
 $(document).ready(function(){
 $(document).ready(function(){

+ 1 - 1
bower.json

@@ -1,6 +1,6 @@
 {
 {
   "name": "jquery.inputmask",
   "name": "jquery.inputmask",
-  "version": "3.1.63-22",
+  "version": "3.1.63-29",
   "main": [
   "main": [
     "./dist/inputmask/jquery.inputmask.js",
     "./dist/inputmask/jquery.inputmask.js",
     "./dist/inputmask/jquery.inputmask.extensions.js",
     "./dist/inputmask/jquery.inputmask.extensions.js",

+ 1 - 1
component.json

@@ -2,7 +2,7 @@
     "name": "jquery_inputmask",
     "name": "jquery_inputmask",
     "repository": "robinherbots/jquery.inputmask",
     "repository": "robinherbots/jquery.inputmask",
     "description": "jquery.inputmask is a jquery plugin which create an input mask.",
     "description": "jquery.inputmask is a jquery plugin which create an input mask.",
-    "version": "3.1.63-22",
+    "version": "3.1.63-29",
     "keywords": [ "jquery", "plugins", "input", "form", "inputmask", "mask" ],
     "keywords": [ "jquery", "plugins", "input", "form", "inputmask", "mask" ],
     "main": "./dist/jquery.inputmask.bundle.js",
     "main": "./dist/jquery.inputmask.bundle.js",
     "scripts": [
     "scripts": [

+ 1 - 1
composer.json

@@ -1,7 +1,7 @@
 {
 {
     "name": "robinherbots/jquery.inputmask",
     "name": "robinherbots/jquery.inputmask",
     "description": "jquery.inputmask is a jquery plugin which create an input mask.",
     "description": "jquery.inputmask is a jquery plugin which create an input mask.",
-	"version": "3.1.63-22",
+	"version": "3.1.63-29",
     "type": "library",
     "type": "library",
     "keywords": ["jquery", "plugins", "input", "form", "inputmask", "mask"],
     "keywords": ["jquery", "plugins", "input", "form", "inputmask", "mask"],
     "homepage": "http://robinherbots.github.io/jquery.inputmask",
     "homepage": "http://robinherbots.github.io/jquery.inputmask",

+ 1 - 1
dist/inputmask/jquery.inputmask.date.extensions.js

@@ -3,7 +3,7 @@
 * http://github.com/RobinHerbots/jquery.inputmask
 * http://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2015 Robin Herbots
 * Copyright (c) 2010 - 2015 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: 3.1.63-22
+* Version: 3.1.63-29
 */
 */
 !function(factory) {
 !function(factory) {
     "function" == typeof define && define.amd ? define([ "jquery", "./jquery.inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("jquery"), require("./jquery.inputmask")) : factory(jQuery);
     "function" == typeof define && define.amd ? define([ "jquery", "./jquery.inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("jquery"), require("./jquery.inputmask")) : factory(jQuery);

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


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

@@ -3,7 +3,7 @@
 * http://github.com/RobinHerbots/jquery.inputmask
 * http://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2015 Robin Herbots
 * Copyright (c) 2010 - 2015 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: 3.1.63-22
+* Version: 3.1.63-29
 */
 */
 !function(factory) {
 !function(factory) {
     "function" == typeof define && define.amd ? define([ "jquery", "./jquery.inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("jquery"), require("./jquery.inputmask")) : factory(jQuery);
     "function" == typeof define && define.amd ? define([ "jquery", "./jquery.inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("jquery"), require("./jquery.inputmask")) : factory(jQuery);

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


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


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


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

@@ -3,7 +3,7 @@
 * http://github.com/RobinHerbots/jquery.inputmask
 * http://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2015 Robin Herbots
 * Copyright (c) 2010 - 2015 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: 3.1.63-22
+* Version: 3.1.63-29
 */
 */
 !function(factory) {
 !function(factory) {
     "function" == typeof define && define.amd ? define([ "jquery", "./jquery.inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("jquery"), require("./jquery.inputmask")) : factory(jQuery);
     "function" == typeof define && define.amd ? define([ "jquery", "./jquery.inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("jquery"), require("./jquery.inputmask")) : factory(jQuery);

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


+ 1 - 1
dist/inputmask/jquery.inputmask.phone.extensions.js

@@ -3,7 +3,7 @@
 * http://github.com/RobinHerbots/jquery.inputmask
 * http://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2015 Robin Herbots
 * Copyright (c) 2010 - 2015 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: 3.1.63-22
+* Version: 3.1.63-29
 */
 */
 !function(factory) {
 !function(factory) {
     "function" == typeof define && define.amd ? define([ "jquery", "./jquery.inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("jquery"), require("./jquery.inputmask")) : factory(jQuery);
     "function" == typeof define && define.amd ? define([ "jquery", "./jquery.inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("jquery"), require("./jquery.inputmask")) : factory(jQuery);

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


+ 1 - 1
dist/inputmask/jquery.inputmask.regex.extensions.js

@@ -3,7 +3,7 @@
 * http://github.com/RobinHerbots/jquery.inputmask
 * http://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2015 Robin Herbots
 * Copyright (c) 2010 - 2015 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: 3.1.63-22
+* Version: 3.1.63-29
 */
 */
 !function(factory) {
 !function(factory) {
     "function" == typeof define && define.amd ? define([ "jquery", "./jquery.inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("jquery"), require("./jquery.inputmask")) : factory(jQuery);
     "function" == typeof define && define.amd ? define([ "jquery", "./jquery.inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("jquery"), require("./jquery.inputmask")) : factory(jQuery);

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


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


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


+ 8 - 7
js/jquery.inputmask.js

@@ -865,7 +865,7 @@
                                                 if (validPos) {
                                                 if (validPos) {
                                                     if (validPos.match.fn != null) {
                                                     if (validPos.match.fn != null) {
                                                         validInputs.push(validPos.input);
                                                         validInputs.push(validPos.input);
-                                                    } 
+                                                    }
                                                 }
                                                 }
                                                 delete getMaskSet()["validPositions"][i];
                                                 delete getMaskSet()["validPositions"][i];
                                                 delete getMaskSet()["tests"][i];
                                                 delete getMaskSet()["tests"][i];
@@ -1230,11 +1230,12 @@
 
 
                 var lvTestAlt = lvTest && lvTest.alternation != undefined ? lvTest["locator"][lvTest.alternation] : undefined;
                 var lvTestAlt = lvTest && lvTest.alternation != undefined ? lvTest["locator"][lvTest.alternation] : undefined;
                 for (pos = bl - 1; pos > lvp; pos--) {
                 for (pos = bl - 1; pos > lvp; pos--) {
-                    testPos = positions[pos]["match"];
-                    if ((testPos.optionality ||
-                        testPos.optionalQuantifier ||
-                        (lvTestAlt && lvTestAlt != positions[pos]["locator"][lvTest.alternation]))
-                        && buffer[pos] == getPlaceholder(pos, testPos)) {
+                    testPos = positions[pos];
+                    if ((testPos.match.optionality ||
+                        testPos.match.optionalQuantifier ||
+                        (lvTestAlt && ((lvTestAlt != positions[pos]["locator"][lvTest.alternation] && testPos.match.fn != null) ||
+                        (testPos.match.fn == null && testPos.locator[lvTest.alternation] && checkAlternationMatch(testPos.locator[lvTest.alternation].toString().split(","), lvTestAlt.split(",")) && getTests(pos)[0].def != ""))))
+                        && buffer[pos] == getPlaceholder(pos, testPos.match)) {
                         bl--;
                         bl--;
                     } else break;
                     } else break;
                 }
                 }
@@ -1866,7 +1867,7 @@
                                         caret(input, $.inArray(opts.radixPoint, getBuffer()));
                                         caret(input, $.inArray(opts.radixPoint, getBuffer()));
                                         firstClick = false;
                                         firstClick = false;
                                     } else {
                                     } else {
-                                        var clickPosition = isRTL ? TranslatePosition(selectedCaret.begin) : selectedCaret.begin,
+                                        var clickPosition = TranslatePosition(selectedCaret.begin),
                                             lastPosition = seekNext(getLastValidPosition(clickPosition));
                                             lastPosition = seekNext(getLastValidPosition(clickPosition));
 
 
                                         if (clickPosition < lastPosition) {
                                         if (clickPosition < lastPosition) {

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
 {
   "name": "jquery.inputmask",
   "name": "jquery.inputmask",
-  "version": "3.1.63-22",
+  "version": "3.1.63-29",
   "description": "jquery.inputmask is a jquery plugin which create an input mask.",
   "description": "jquery.inputmask is a jquery plugin which create an input mask.",
   "main": "./dist/inputmask/jquery.inputmask.js",
   "main": "./dist/inputmask/jquery.inputmask.js",
   "files": [
   "files": [

+ 2 - 2
qunit/tests_paste.js

@@ -1,10 +1,10 @@
 module("Paste value");
 module("Paste value");
-asyncTest("inputmask(\"+7 (999) 999-99-99\") ~ paste \"+7 (+79114041112___) ___-__-__\"", function () {
+asyncTest("inputmask(\"+7 (999) 999-99-99\") ~ paste \"+79114041112\"", function () {
     var $fixture = $("#qunit-fixture");
     var $fixture = $("#qunit-fixture");
     $fixture.append('<input type="text" id="testmask" />');
     $fixture.append('<input type="text" id="testmask" />');
     $("#testmask").inputmask("+7 (999) 999-99-99");
     $("#testmask").inputmask("+7 (999) 999-99-99");
     $("#testmask")[0].focus();
     $("#testmask")[0].focus();
-    $("#testmask").paste("+7 (+79114041112___) ___-__-__");
+    $("#testmask").paste("+79114041112");
 
 
     setTimeout(function () {
     setTimeout(function () {
         equal($("#testmask").val(), "+7 (911) 404-11-12", "Result " + $("#testmask").val());
         equal($("#testmask").val(), "+7 (911) 404-11-12", "Result " + $("#testmask").val());