ソースを参照

fix option resolving

Robin Herbots 10 年 前
コミット
ce41a9f38b

+ 1 - 1
bower.json

@@ -1,6 +1,6 @@
 {
   "name": "jquery.inputmask",
-  "version": "3.1.62-3",
+  "version": "3.1.62-4",
   "main": [
     "./dist/inputmask/jquery.inputmask.js",
     "./dist/inputmask/jquery.inputmask.extensions.js",

+ 1 - 1
component.json

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

+ 1 - 1
composer.json

@@ -1,7 +1,7 @@
 {
     "name": "robinherbots/jquery.inputmask",
     "description": "jquery.inputmask is a jquery plugin which create an input mask.",
-	"version": "3.1.62-3",
+	"version": "3.1.62-4",
     "type": "library",
     "keywords": ["jquery", "plugins", "input", "form", "inputmask", "mask"],
     "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
 * Copyright (c) 2010 - 2015 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.1.62-3
+* Version: 3.1.62-4
 */
 !function(factory) {
     "function" == typeof define && define.amd ? define([ "jquery", "./jquery.inputmask" ], factory) : 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
 * Copyright (c) 2010 - 2015 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.1.62-3
+* Version: 3.1.62-4
 */
 !function(factory) {
     "function" == typeof define && define.amd ? define([ "jquery", "./jquery.inputmask" ], factory) : factory(jQuery);

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


+ 11 - 12
dist/inputmask/jquery.inputmask.js

@@ -3,7 +3,7 @@
 * http://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2015 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.1.62-3
+* Version: 3.1.62-4
 */
 !function(factory) {
     "function" == typeof define && define.amd ? define([ "jquery" ], factory) : factory(jQuery);
@@ -1191,7 +1191,7 @@
         }, $.fn.inputmask = function(fn, options) {
             function importAttributeOptions(npt, opts, importedOptionsContainer) {
                 var $npt = $(npt);
-                $npt.data("inputmask-alias") && resolveAlias($npt.data("inputmask-alias"), {}, opts);
+                $npt.data("inputmask-alias") && resolveAlias($npt.data("inputmask-alias"), $.extend(!0, {}, opts), opts);
                 for (var option in opts) {
                     var optionData = $npt.data("inputmask-" + option.toLowerCase());
                     void 0 != optionData && ("mask" == option && 0 == optionData.indexOf("[") ? (opts[option] = optionData.replace(/[\s[\]]/g, "").split("','"), 
@@ -1203,12 +1203,11 @@
             var maskset, opts = $.extend(!0, {}, $.inputmask.defaults, options);
             if ("string" == typeof fn) switch (fn) {
               case "mask":
-                return resolveAlias(opts.alias, options, opts), maskset = generateMaskSet(opts), 
-                void 0 == maskset ? this : this.each(function() {
-                    maskScope({
+                return resolveAlias(opts.alias, options, opts), this.each(function() {
+                    return importAttributeOptions(this, opts), maskset = generateMaskSet(opts), void 0 == maskset ? this : void maskScope({
                         action: "mask",
                         el: this
-                    }, $.extend(!0, {}, maskset), importAttributeOptions(this, opts));
+                    }, maskset, opts);
                 });
 
               case "unmaskedvalue":
@@ -1251,19 +1250,19 @@
 
               default:
                 return resolveAlias(opts.alias, options, opts), resolveAlias(fn, options, opts) || (opts.mask = fn), 
-                maskset = generateMaskSet(opts), void 0 == maskset ? this : this.each(function() {
-                    maskScope({
+                this.each(function() {
+                    return importAttributeOptions(this, opts), maskset = generateMaskSet(opts), void 0 == maskset ? this : void maskScope({
                         action: "mask",
                         el: this
-                    }, $.extend(!0, {}, maskset), importAttributeOptions(this, opts));
+                    }, maskset, opts);
                 });
             } else {
                 if ("object" == typeof fn) return opts = $.extend(!0, {}, $.inputmask.defaults, fn), 
-                resolveAlias(opts.alias, fn, opts), maskset = generateMaskSet(opts), void 0 == maskset ? this : this.each(function() {
-                    maskScope({
+                resolveAlias(opts.alias, fn, opts), this.each(function() {
+                    return importAttributeOptions(this, opts), maskset = generateMaskSet(opts), void 0 == maskset ? this : void maskScope({
                         action: "mask",
                         el: this
-                    }, $.extend(!0, {}, maskset), importAttributeOptions(this, opts));
+                    }, maskset, opts);
                 });
                 if (void 0 == fn) return this.each(function() {
                     var attrOptions = $(this).attr("data-inputmask");

ファイルの差分が大きいため隠しています
+ 2 - 2
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
 * Copyright (c) 2010 - 2015 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.1.62-3
+* Version: 3.1.62-4
 */
 !function(factory) {
     "function" == typeof define && define.amd ? define([ "jquery", "./jquery.inputmask" ], factory) : 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
 * Copyright (c) 2010 - 2015 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.1.62-3
+* Version: 3.1.62-4
 */
 !function(factory) {
     "function" == typeof define && define.amd ? define([ "jquery", "./jquery.inputmask" ], factory) : 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
 * Copyright (c) 2010 - 2015 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.1.62-3
+* Version: 3.1.62-4
 */
 !function(factory) {
     "function" == typeof define && define.amd ? define([ "jquery", "./jquery.inputmask" ], factory) : factory(jQuery);

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


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

@@ -3,7 +3,7 @@
 * http://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2015 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.1.62-3
+* Version: 3.1.62-4
 */
 !function($) {
     function isInputEventSupported(eventName) {
@@ -1189,7 +1189,7 @@
         }, $.fn.inputmask = function(fn, options) {
             function importAttributeOptions(npt, opts, importedOptionsContainer) {
                 var $npt = $(npt);
-                $npt.data("inputmask-alias") && resolveAlias($npt.data("inputmask-alias"), {}, opts);
+                $npt.data("inputmask-alias") && resolveAlias($npt.data("inputmask-alias"), $.extend(!0, {}, opts), opts);
                 for (var option in opts) {
                     var optionData = $npt.data("inputmask-" + option.toLowerCase());
                     void 0 != optionData && ("mask" == option && 0 == optionData.indexOf("[") ? (opts[option] = optionData.replace(/[\s[\]]/g, "").split("','"), 
@@ -1201,12 +1201,11 @@
             var maskset, opts = $.extend(!0, {}, $.inputmask.defaults, options);
             if ("string" == typeof fn) switch (fn) {
               case "mask":
-                return resolveAlias(opts.alias, options, opts), maskset = generateMaskSet(opts), 
-                void 0 == maskset ? this : this.each(function() {
-                    maskScope({
+                return resolveAlias(opts.alias, options, opts), this.each(function() {
+                    return importAttributeOptions(this, opts), maskset = generateMaskSet(opts), void 0 == maskset ? this : void maskScope({
                         action: "mask",
                         el: this
-                    }, $.extend(!0, {}, maskset), importAttributeOptions(this, opts));
+                    }, maskset, opts);
                 });
 
               case "unmaskedvalue":
@@ -1249,19 +1248,19 @@
 
               default:
                 return resolveAlias(opts.alias, options, opts), resolveAlias(fn, options, opts) || (opts.mask = fn), 
-                maskset = generateMaskSet(opts), void 0 == maskset ? this : this.each(function() {
-                    maskScope({
+                this.each(function() {
+                    return importAttributeOptions(this, opts), maskset = generateMaskSet(opts), void 0 == maskset ? this : void maskScope({
                         action: "mask",
                         el: this
-                    }, $.extend(!0, {}, maskset), importAttributeOptions(this, opts));
+                    }, maskset, opts);
                 });
             } else {
                 if ("object" == typeof fn) return opts = $.extend(!0, {}, $.inputmask.defaults, fn), 
-                resolveAlias(opts.alias, fn, opts), maskset = generateMaskSet(opts), void 0 == maskset ? this : this.each(function() {
-                    maskScope({
+                resolveAlias(opts.alias, fn, opts), this.each(function() {
+                    return importAttributeOptions(this, opts), maskset = generateMaskSet(opts), void 0 == maskset ? this : void maskScope({
                         action: "mask",
                         el: this
-                    }, $.extend(!0, {}, maskset), importAttributeOptions(this, opts));
+                    }, maskset, opts);
                 });
                 if (void 0 == fn) return this.each(function() {
                     var attrOptions = $(this).attr("data-inputmask");

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


+ 14 - 12
js/jquery.inputmask.js

@@ -2060,7 +2060,7 @@
             function importAttributeOptions(npt, opts, importedOptionsContainer) {
                 var $npt = $(npt);
                 if ($npt.data("inputmask-alias")) {
-                    resolveAlias($npt.data("inputmask-alias"), {}, opts);
+                    resolveAlias($npt.data("inputmask-alias"), $.extend(true, {}, opts), opts);
                 }
                 for (var option in opts) {
                     var optionData = $npt.data("inputmask-" + option.toLowerCase());
@@ -2083,13 +2083,12 @@
             if (typeof fn === "string") {
                 switch (fn) {
                     case "mask":
-                        //resolve possible aliases given by options
                         resolveAlias(opts.alias, options, opts);
-                        maskset = generateMaskSet(opts);
-                        if (maskset == undefined) { return this; }
-
                         return this.each(function () {
-                            maskScope({ "action": "mask", "el": this }, $.extend(true, {}, maskset), importAttributeOptions(this, opts));
+                            importAttributeOptions(this, opts)
+                            maskset = generateMaskSet(opts);
+                            if (maskset == undefined) { return this; }
+                            maskScope({ "action": "mask", "el": this }, maskset, opts);
                         });
                     case "unmaskedvalue":
                         var $input = $(this);
@@ -2127,19 +2126,22 @@
                             //set mask
                             opts.mask = fn;
                         }
-                        maskset = generateMaskSet(opts);
-                        if (maskset == undefined) { return this; }
+
                         return this.each(function () {
-                            maskScope({ "action": "mask", "el": this }, $.extend(true, {}, maskset), importAttributeOptions(this, opts));
+                            importAttributeOptions(this, opts);
+                            maskset = generateMaskSet(opts);
+                            if (maskset == undefined) { return this; }
+                            maskScope({ "action": "mask", "el": this }, maskset, opts);
                         });
                 }
             } else if (typeof fn == "object") {
                 opts = $.extend(true, {}, $.inputmask.defaults, fn);
                 resolveAlias(opts.alias, fn, opts); //resolve aliases
-                maskset = generateMaskSet(opts);
-                if (maskset == undefined) { return this; }
                 return this.each(function () {
-                    maskScope({ "action": "mask", "el": this }, $.extend(true, {}, maskset), importAttributeOptions(this, opts));
+                    importAttributeOptions(this, opts);
+                    maskset = generateMaskSet(opts);
+                    if (maskset == undefined) { return this; }
+                    maskScope({ "action": "mask", "el": this }, maskset, opts);
                 });
             } else if (fn == undefined) {
                 //look for data-inputmask atribute - the attribute should only contain optipns

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "jquery.inputmask",
-  "version": "3.1.62-3",
+  "version": "3.1.62-4",
   "description": "jquery.inputmask is a jquery plugin which create an input mask.",
   "main": "./dist/inputmask/jquery.inputmask.js",
   "scripts": {