ソースを参照

fix document dependency in inputmask.binding

Robin Herbots 7 年 前
コミット
66c940a226

+ 1 - 1
bower.json

@@ -1,6 +1,6 @@
 {
   "name": "inputmask",
-  "version": "4.0.3-beta.6",
+  "version": "4.0.3-beta.7",
   "main": [
 	  "./index.js",
     "./css/inputmask.css"

+ 1 - 1
composer.json

@@ -1,7 +1,7 @@
 {
   "name": "robinherbots/inputmask",
   "description": "Inputmask is a javascript library which creates an input mask.  Inputmask can run against vanilla javascript, jQuery and jqlite.",
-  "version": "4.0.3-beta.6",
+  "version": "4.0.3-beta.7",
   "type": "library",
   "keywords": ["jquery", "plugins", "input", "form", "inputmask", "mask"],
   "homepage": "http://robinherbots.github.io/Inputmask",

+ 6 - 6
dist/inputmask/bindings/inputmask.binding.js

@@ -3,19 +3,19 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.3-beta.6
+* Version: 4.0.3-beta.7
 */
 
 (function(factory) {
     if (typeof define === "function" && define.amd) {
-        define([ "jquery", "../inputmask", "../global/document" ], factory);
+        define([ "jquery", "../inputmask", "../global/window" ], factory);
     } else if (typeof exports === "object") {
-        module.exports = factory(require("jquery"), require("../inputmask"), require("../global/document"));
+        module.exports = factory(require("jquery"), require("../inputmask"), require("../global/window"));
     } else {
-        factory(jQuery, window.Inputmask, document);
+        factory(jQuery, window.Inputmask, window);
     }
-})(function($, Inputmask, document) {
-    $(document).ajaxComplete(function(event, xmlHttpRequest, ajaxOptions) {
+})(function($, Inputmask, window) {
+    $(window.document).ajaxComplete(function(event, xmlHttpRequest, ajaxOptions) {
         if ($.inArray("html", ajaxOptions.dataTypes) !== -1) {
             $(".inputmask, [data-inputmask], [data-inputmask-mask], [data-inputmask-alias]").each(function(ndx, lmnt) {
                 if (lmnt.inputmask === undefined) {

+ 1 - 1
dist/inputmask/dependencyLibs/inputmask.dependencyLib.jqlite.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.3-beta.6
+* Version: 4.0.3-beta.7
 */
 
 (function(factory) {

+ 1 - 1
dist/inputmask/dependencyLibs/inputmask.dependencyLib.jquery.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.3-beta.6
+* Version: 4.0.3-beta.7
 */
 
 (function(factory) {

+ 1 - 1
dist/inputmask/dependencyLibs/inputmask.dependencyLib.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.3-beta.6
+* Version: 4.0.3-beta.7
 */
 
 (function(factory) {

+ 1 - 1
dist/inputmask/global/window.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.3-beta.6
+* Version: 4.0.3-beta.7
 */
 
 if (typeof define === "function" && define.amd) define(function() {

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

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.3-beta.6
+* Version: 4.0.3-beta.7
 */
 
 (function(factory) {

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

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.3-beta.6
+* Version: 4.0.3-beta.7
 */
 
 (function(factory) {

+ 8 - 3
dist/inputmask/inputmask.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.3-beta.6
+* Version: 4.0.3-beta.7
 */
 
 (function(factory) {
@@ -830,7 +830,7 @@
             return valid;
         }
         function getTests(pos, ndxIntlzr, tstPs) {
-            var maskTokens = getMaskSet().maskToken, testPos = ndxIntlzr ? tstPs : 0, ndxInitializer = ndxIntlzr ? ndxIntlzr.slice() : [ 0 ], matches = [], insertStop = false, latestMatch, cacheDependency = ndxIntlzr ? ndxIntlzr.join("") : "", offset = 0;
+            var maskTokens = getMaskSet().maskToken, testPos = ndxIntlzr ? tstPs : 0, ndxInitializer = ndxIntlzr ? ndxIntlzr.slice() : [ 0 ], matches = [], insertStop = false, latestMatch, cacheDependency = ndxIntlzr ? ndxIntlzr.join("") : "";
             function resolveTestFromToken(maskToken, ndxInitializer, loopNdx, quantifierRecurse) {
                 function handleMatch(match, loopNdx, quantifierRecurse) {
                     function isFirstMatch(latestMatch, tokenGroup) {
@@ -886,7 +886,8 @@
                         return source.match.def === target.match.nativeDef;
                     }
                     function staticCanMatchDefinition(source, target) {
-                        var sloc = source.locator.slice(source.alternation).join(""), tloc = target.locator.slice(target.alternation).join(""), canMatch = sloc == tloc, canMatch = canMatch && source.match.fn === null && target.match.fn !== null ? target.match.fn.test(source.match.def, getMaskSet(), pos, false, opts, false) : false;
+                        var sloc = source.locator.slice(source.alternation).join(""), tloc = target.locator.slice(target.alternation).join(""), canMatch = sloc == tloc;
+                        canMatch = canMatch && source.match.fn === null && target.match.fn !== null ? target.match.fn.test(source.match.def, getMaskSet(), pos, false, opts, false) : false;
                         return canMatch;
                     }
                     function setMergeLocators(targetMatch, altMatch) {
@@ -1026,6 +1027,9 @@
                                         testPos = pos;
                                         break;
                                     }
+                                    if (latestMatch.jit && !latestMatch.optionalQuantifier) {
+                                        latestMatch.jitOffset = tokenGroup.matches.indexOf(latestMatch);
+                                    }
                                     return true;
                                 }
                             }
@@ -1111,6 +1115,7 @@
                 return $.extend(true, [], matches);
             }
             getMaskSet().tests[pos] = $.extend(true, [], matches);
+            console.log(pos + " - " + JSON.stringify(matches));
             return getMaskSet().tests[pos];
         }
         function getBufferTemplate() {

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

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.3-beta.6
+* Version: 4.0.3-beta.7
 */
 
 (function(factory) {

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

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.3-beta.6
+* Version: 4.0.3-beta.7
 */
 
 (function(factory) {

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

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.3-beta.6
+* Version: 4.0.3-beta.7
 */
 
 (function(modules) {
@@ -1017,7 +1017,7 @@
                 return valid;
             }
             function getTests(pos, ndxIntlzr, tstPs) {
-                var maskTokens = getMaskSet().maskToken, testPos = ndxIntlzr ? tstPs : 0, ndxInitializer = ndxIntlzr ? ndxIntlzr.slice() : [ 0 ], matches = [], insertStop = false, latestMatch, cacheDependency = ndxIntlzr ? ndxIntlzr.join("") : "", offset = 0;
+                var maskTokens = getMaskSet().maskToken, testPos = ndxIntlzr ? tstPs : 0, ndxInitializer = ndxIntlzr ? ndxIntlzr.slice() : [ 0 ], matches = [], insertStop = false, latestMatch, cacheDependency = ndxIntlzr ? ndxIntlzr.join("") : "";
                 function resolveTestFromToken(maskToken, ndxInitializer, loopNdx, quantifierRecurse) {
                     function handleMatch(match, loopNdx, quantifierRecurse) {
                         function isFirstMatch(latestMatch, tokenGroup) {
@@ -1075,7 +1075,8 @@
                             return source.match.def === target.match.nativeDef;
                         }
                         function staticCanMatchDefinition(source, target) {
-                            var sloc = source.locator.slice(source.alternation).join(""), tloc = target.locator.slice(target.alternation).join(""), canMatch = sloc == tloc, canMatch = canMatch && source.match.fn === null && target.match.fn !== null ? target.match.fn.test(source.match.def, getMaskSet(), pos, false, opts, false) : false;
+                            var sloc = source.locator.slice(source.alternation).join(""), tloc = target.locator.slice(target.alternation).join(""), canMatch = sloc == tloc;
+                            canMatch = canMatch && source.match.fn === null && target.match.fn !== null ? target.match.fn.test(source.match.def, getMaskSet(), pos, false, opts, false) : false;
                             return canMatch;
                         }
                         function setMergeLocators(targetMatch, altMatch) {
@@ -1215,6 +1216,9 @@
                                             testPos = pos;
                                             break;
                                         }
+                                        if (latestMatch.jit && !latestMatch.optionalQuantifier) {
+                                            latestMatch.jitOffset = tokenGroup.matches.indexOf(latestMatch);
+                                        }
                                         return true;
                                     }
                                 }
@@ -1300,6 +1304,7 @@
                     return $.extend(true, [], matches);
                 }
                 getMaskSet().tests[pos] = $.extend(true, [], matches);
+                console.log(pos + " - " + JSON.stringify(matches));
                 return getMaskSet().tests[pos];
             }
             function getBufferTemplate() {

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


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


+ 1 - 1
dist/min/inputmask/dependencyLibs/inputmask.dependencyLib.jquery.min.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.3-beta.6
+* Version: 4.0.3-beta.7
 */
 
 (function(factory){if(typeof define==="function"&&define.amd){define(["jquery"],factory)}else if(typeof exports==="object"){module.exports=factory(require("jquery"))}else{window.dependencyLib=factory(jQuery)}})(function($){return $});

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


+ 1 - 1
dist/min/inputmask/global/window.min.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.3-beta.6
+* Version: 4.0.3-beta.7
 */
 
 if(typeof define==="function"&&define.amd)define(function(){return window||new(eval("require('jsdom')")("").window)});else if(typeof exports==="object")module.exports=window||new(eval("require('jsdom')")("").window);

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


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


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


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


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


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


+ 5 - 5
js/bindings/inputmask.binding.js

@@ -6,15 +6,15 @@
  */
 (function (factory) {
 	if (typeof define === "function" && define.amd) {
-		define(["jquery", "../inputmask", "../global/document"], factory);
+		define(["jquery", "../inputmask", "../global/window"], factory);
 	} else if (typeof exports === "object") {
-		module.exports = factory(require("jquery"), require("../inputmask"), require("../global/document"));
+		module.exports = factory(require("jquery"), require("../inputmask"), require("../global/window"));
 	} else {
-		factory(jQuery, window.Inputmask, document);
+		factory(jQuery, window.Inputmask, window);
 	}
 }
-(function ($, Inputmask, document) {
-	$(document).ajaxComplete(function (event, xmlHttpRequest, ajaxOptions) {
+(function ($, Inputmask, window) {
+	$(window.document).ajaxComplete(function (event, xmlHttpRequest, ajaxOptions) {
 		if ($.inArray("html", ajaxOptions.dataTypes) !== -1) {
 			$(".inputmask, [data-inputmask], [data-inputmask-mask], [data-inputmask-alias]").each(function (ndx, lmnt) {
 				if (lmnt.inputmask === undefined) {

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "inputmask",
-  "version": "4.0.3-beta.6",
+  "version": "4.0.3-beta.7",
   "description": "Inputmask is a javascript library which creates an input mask.  Inputmask can run against vanilla javascript, jQuery and jqlite.",
   "main": "index.js",
   "files": [