Browse Source

move format & isvalid to inputmask

Robin Herbots 10 years ago
parent
commit
25337ee9cf

+ 2 - 2
README.md

@@ -878,14 +878,14 @@ $(document).ready(function(){
 Instead of masking an input element it is also possible to use the inputmask for formatting given values. Think of formatting values to show in jqGrid or on other elements then inputs.
 Instead of masking an input element it is also possible to use the inputmask for formatting given values. Think of formatting values to show in jqGrid or on other elements then inputs.
 
 
 ```javascript
 ```javascript
-var formattedDate = $.inputmask.format("2331973", { alias: "dd/mm/yyyy"});
+var formattedDate = inputmask.format("2331973", { alias: "dd/mm/yyyy"});
 ```
 ```
 
 
 ## Value validating
 ## Value validating
 Validate a given value against the mask.
 Validate a given value against the mask.
 
 
 ```javascript
 ```javascript
-var isValid = $.inputmask.isValid("23/03/1973", { alias: "dd/mm/yyyy"});
+var isValid = inputmask.isValid("23/03/1973", { alias: "dd/mm/yyyy"});
 ```
 ```
 
 
 ## .NET Nuget Package Install
 ## .NET Nuget Package Install

+ 1 - 1
bower.json

@@ -1,6 +1,6 @@
 {
 {
   "name": "jquery.inputmask",
   "name": "jquery.inputmask",
-  "version": "3.1.64-48",
+  "version": "3.1.64-54",
   "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.64-48",
+    "version": "3.1.64-54",
     "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.64-48",
+	"version": "3.1.64-54",
     "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",

+ 2 - 2
dist/inputmask/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.64-48
+* Version: 3.1.64-54
 */
 */
 !function(factory) {
 !function(factory) {
     "function" == typeof define && define.amd ? define([ "jquery", "./inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("jquery"), require("./inputmask")) : factory(jQuery);
     "function" == typeof define && define.amd ? define([ "jquery", "./inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("jquery"), require("./inputmask")) : factory(jQuery);
@@ -457,5 +457,5 @@
             separator: "/",
             separator: "/",
             alias: "mm/dd/yyyy"
             alias: "mm/dd/yyyy"
         }
         }
-    }), $.fn.inputmask;
+    }), inputmask;
 });
 });

File diff suppressed because it is too large
+ 2 - 2
dist/inputmask/inputmask.date.extensions.min.js


+ 2 - 2
dist/inputmask/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.64-48
+* Version: 3.1.64-54
 */
 */
 !function(factory) {
 !function(factory) {
     "function" == typeof define && define.amd ? define([ "jquery", "./inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("jquery"), require("./inputmask")) : factory(jQuery);
     "function" == typeof define && define.amd ? define([ "jquery", "./inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("jquery"), require("./inputmask")) : factory(jQuery);
@@ -103,5 +103,5 @@
                 }
                 }
             }
             }
         }
         }
-    }), $.fn.inputmask;
+    }), inputmask;
 });
 });

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


+ 45 - 60
dist/inputmask/inputmask.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.64-48
+* Version: 3.1.64-54
 */
 */
 !function(factory) {
 !function(factory) {
     "function" == typeof define && define.amd ? define([ "jquery" ], factory) : "object" == typeof exports ? module.exports = factory(require("jquery")) : factory(jQuery);
     "function" == typeof define && define.amd ? define([ "jquery" ], factory) : "object" == typeof exports ? module.exports = factory(require("jquery")) : factory(jQuery);
@@ -669,7 +669,7 @@
             return $.inputmask.escapeRegex(str);
             return $.inputmask.escapeRegex(str);
         }
         }
         function unmaskedvalue($input) {
         function unmaskedvalue($input) {
-            if ($input.data("_inputmask") && !$input.hasClass("hasDatepicker")) {
+            if ($input[0].inputmask && !$input.hasClass("hasDatepicker")) {
                 var umValue = [], vps = getMaskSet().validPositions;
                 var umValue = [], vps = getMaskSet().validPositions;
                 for (var pndx in vps) vps[pndx].match && null != vps[pndx].match.fn && umValue.push(vps[pndx].input);
                 for (var pndx in vps) vps[pndx].match && null != vps[pndx].match.fn && umValue.push(vps[pndx].input);
                 var unmaskedValue = (isRTL ? umValue.reverse() : umValue).join(""), bufferValue = (isRTL ? getBuffer().slice().reverse() : getBuffer()).join("");
                 var unmaskedValue = (isRTL ? umValue.reverse() : umValue).join(""), bufferValue = (isRTL ? getBuffer().slice().reverse() : getBuffer()).join("");
@@ -802,17 +802,17 @@
                     };
                     };
                     $.valHooks[type] = {
                     $.valHooks[type] = {
                         get: function(elem) {
                         get: function(elem) {
-                            var $elem = $(elem);
-                            if ($elem.data("_inputmask")) {
-                                if ($elem.data("_inputmask").opts.autoUnmask) return $elem.inputmask("unmaskedvalue");
-                                var result = valhookGet(elem), inputData = $elem.data("_inputmask"), maskset = inputData.maskset, bufferTemplate = maskset._buffer;
+                            $(elem);
+                            if (elem.inputmask) {
+                                if (elem.inputmask.opts.autoUnmask) return elem.inputmask.unmaskedvalue();
+                                var result = valhookGet(elem), maskset = elem.inputmask.maskset, bufferTemplate = maskset._buffer;
                                 return bufferTemplate = bufferTemplate ? bufferTemplate.join("") : "", result != bufferTemplate ? result : "";
                                 return bufferTemplate = bufferTemplate ? bufferTemplate.join("") : "", result != bufferTemplate ? result : "";
                             }
                             }
                             return valhookGet(elem);
                             return valhookGet(elem);
                         },
                         },
                         set: function(elem, value) {
                         set: function(elem, value) {
-                            var result, $elem = $(elem), inputData = $elem.data("_inputmask");
-                            return result = valhookSet(elem, value), inputData && $elem.triggerHandler("setvalue.inputmask"), 
+                            var result, $elem = $(elem);
+                            return result = valhookSet(elem, value), elem.inputmask && $elem.triggerHandler("setvalue.inputmask"), 
                             result;
                             result;
                         },
                         },
                         inputmaskpatch: !0
                         inputmaskpatch: !0
@@ -820,12 +820,11 @@
                 }
                 }
             }
             }
             function getter() {
             function getter() {
-                var $self = $(this), inputData = $(this).data("_inputmask");
-                return inputData ? inputData.opts.autoUnmask ? $self.inputmask("unmaskedvalue") : valueGet.call(this) != getBufferTemplate().join("") ? valueGet.call(this) : "" : valueGet.call(this);
+                $(this);
+                return this.inputmask ? this.inputmask.opts.autoUnmask ? this.inputmask.unmaskedvalue() : valueGet.call(this) != getBufferTemplate().join("") ? valueGet.call(this) : "" : valueGet.call(this);
             }
             }
             function setter(value) {
             function setter(value) {
-                var inputData = $(this).data("_inputmask");
-                valueSet.call(this, value), inputData && $(this).triggerHandler("setvalue.inputmask");
+                valueSet.call(this, value), this.inputmask && $(this).triggerHandler("setvalue.inputmask");
             }
             }
             function InstallNativeValueSetFallback(npt) {
             function InstallNativeValueSetFallback(npt) {
                 $(npt).bind("mouseenter.inputmask", function(event) {
                 $(npt).bind("mouseenter.inputmask", function(event) {
@@ -1005,17 +1004,9 @@
         }
         }
         function compositionEndEvent(e) {}
         function compositionEndEvent(e) {}
         function mask(el) {
         function mask(el) {
-            if ($el = $(el), $el.data("_inputmask", {
-                maskset: maskset,
-                opts: opts,
-                isRTL: !1
-            }), opts.showTooltip && $el.prop("title", getMaskSet().mask), ("rtl" == el.dir || opts.rightAlign) && $el.css("text-align", "right"), 
-            "rtl" == el.dir || opts.numericInput) {
-                el.dir = "ltr", $el.removeAttr("dir");
-                var inputData = $el.data("_inputmask");
-                inputData.isRTL = !0, $el.data("_inputmask", inputData), isRTL = !0;
-            }
-            $el.unbind(".inputmask"), ($el.is(":input") && isInputTypeSupported($el.attr("type")) || el.isContentEditable) && ($el.closest("form").bind("submit", function(e) {
+            $el = $(el), opts.showTooltip && $el.prop("title", getMaskSet().mask), ("rtl" == el.dir || opts.rightAlign) && $el.css("text-align", "right"), 
+            ("rtl" == el.dir || opts.numericInput) && (el.dir = "ltr", $el.removeAttr("dir"), 
+            el.inputmask.isRTL = !0, isRTL = !0), $el.unbind(".inputmask"), ($el.is(":input") && isInputTypeSupported($el.attr("type")) || el.isContentEditable) && ($el.closest("form").bind("submit", function(e) {
                 undoValue != getBuffer().join("") && $el.change(), opts.clearMaskOnLostFocus && $el[0]._valueGet && $el[0]._valueGet() == getBufferTemplate().join("") && $el[0]._valueSet(""), 
                 undoValue != getBuffer().join("") && $el.change(), opts.clearMaskOnLostFocus && $el[0]._valueGet && $el[0]._valueGet() == getBufferTemplate().join("") && $el[0]._valueSet(""), 
                 opts.removeMaskOnSubmit && $el.inputmask("remove");
                 opts.removeMaskOnSubmit && $el.inputmask("remove");
             }).bind("reset", function() {
             }).bind("reset", function() {
@@ -1027,7 +1018,7 @@
                 !$input.is(":focus") && opts.showMaskOnHover && input._valueGet() != getBuffer().join("") && writeBuffer(input, getBuffer());
                 !$input.is(":focus") && opts.showMaskOnHover && input._valueGet() != getBuffer().join("") && writeBuffer(input, getBuffer());
             }).bind("blur.inputmask", function(e) {
             }).bind("blur.inputmask", function(e) {
                 var $input = $(this), input = this;
                 var $input = $(this), input = this;
-                if ($input.data("_inputmask")) {
+                if (input.inputmask) {
                     var nptValue = input._valueGet(), buffer = getBuffer().slice();
                     var nptValue = input._valueGet(), buffer = getBuffer().slice();
                     firstClick = !0, undoValue != buffer.join("") && setTimeout(function() {
                     firstClick = !0, undoValue != buffer.join("") && setTimeout(function() {
                         $input.change(), undoValue = buffer.join("");
                         $input.change(), undoValue = buffer.join("");
@@ -1091,23 +1082,21 @@
         var undoValue, compositionCaretPos, compositionData, $el, maxLength, isRTL = !1, skipKeyPressEvent = !1, skipInputEvent = !1, ignorable = !1, firstClick = !0;
         var undoValue, compositionCaretPos, compositionData, $el, maxLength, isRTL = !1, skipKeyPressEvent = !1, skipInputEvent = !1, ignorable = !1, firstClick = !0;
         if (void 0 != actionObj) switch (actionObj.action) {
         if (void 0 != actionObj) switch (actionObj.action) {
           case "isComplete":
           case "isComplete":
-            return $el = $(actionObj.el), maskset = $el.data("_inputmask").maskset, opts = $el.data("_inputmask").opts, 
+            return el = actionObj.el, $el = $(el), maskset = el.inputmask.maskset, opts = el.inputmask.opts, 
             isComplete(actionObj.buffer);
             isComplete(actionObj.buffer);
 
 
           case "unmaskedvalue":
           case "unmaskedvalue":
-            return $el = $(actionObj.el), maskset = $el.data("_inputmask").maskset, opts = $el.data("_inputmask").opts, 
-            isRTL = $el.data("_inputmask").isRTL, unmaskedvalue($el);
+            return el = actionObj.el, $el = $(el), maskset = el.inputmask.maskset, opts = el.inputmask.opts, 
+            isRTL = el.inputmask.isRTL, unmaskedvalue($el);
 
 
           case "mask":
           case "mask":
             undoValue = getBuffer().join(""), mask(actionObj.el);
             undoValue = getBuffer().join(""), mask(actionObj.el);
             break;
             break;
 
 
           case "format":
           case "format":
-            $el = $({}), $el.data("_inputmask", {
-                maskset: maskset,
-                opts: opts,
-                isRTL: opts.numericInput
-            }), opts.numericInput && (isRTL = !0);
+            $el = $({}), $el[0].inputmask = new inputmask(), $el[0].inputmask.opts = opts, $el[0].inputmask.el = $el[0], 
+            $el[0].inputmask.maskset = maskset, $el[0].inputmask.isRTL = opts.numericInput, 
+            opts.numericInput && (isRTL = !0);
             var valueBuffer = ($.isFunction(opts.onBeforeMask) ? opts.onBeforeMask.call($el, actionObj.value, opts) || actionObj.value : actionObj.value).split("");
             var valueBuffer = ($.isFunction(opts.onBeforeMask) ? opts.onBeforeMask.call($el, actionObj.value, opts) || actionObj.value : actionObj.value).split("");
             return checkVal($el, !1, !1, isRTL ? valueBuffer.reverse() : valueBuffer), $.isFunction(opts.onBeforeWrite) && opts.onBeforeWrite.call(this, void 0, getBuffer(), 0, opts), 
             return checkVal($el, !1, !1, isRTL ? valueBuffer.reverse() : valueBuffer), $.isFunction(opts.onBeforeWrite) && opts.onBeforeWrite.call(this, void 0, getBuffer(), 0, opts), 
             actionObj.metadata ? {
             actionObj.metadata ? {
@@ -1116,24 +1105,21 @@
             } : isRTL ? getBuffer().slice().reverse().join("") : getBuffer().join("");
             } : isRTL ? getBuffer().slice().reverse().join("") : getBuffer().join("");
 
 
           case "isValid":
           case "isValid":
-            $el = $({}), $el.data("_inputmask", {
-                maskset: maskset,
-                opts: opts,
-                isRTL: opts.numericInput
-            }), opts.numericInput && (isRTL = !0);
+            $el = $({}), $el[0].inputmask = new inputmask(), $el[0].inputmask.opts = opts, $el[0].inputmask.el = $el[0], 
+            $el[0].inputmask.maskset = maskset, $el[0].inputmask.isRTL = opts.numericInput, 
+            opts.numericInput && (isRTL = !0);
             var valueBuffer = actionObj.value.split("");
             var valueBuffer = actionObj.value.split("");
             checkVal($el, !1, !0, isRTL ? valueBuffer.reverse() : valueBuffer);
             checkVal($el, !1, !0, isRTL ? valueBuffer.reverse() : valueBuffer);
             for (var buffer = getBuffer(), rl = determineLastRequiredPosition(), lmib = buffer.length - 1; lmib > rl && !isMask(lmib); lmib--) ;
             for (var buffer = getBuffer(), rl = determineLastRequiredPosition(), lmib = buffer.length - 1; lmib > rl && !isMask(lmib); lmib--) ;
             return buffer.splice(rl, lmib + 1 - rl), isComplete(buffer) && actionObj.value == buffer.join("");
             return buffer.splice(rl, lmib + 1 - rl), isComplete(buffer) && actionObj.value == buffer.join("");
 
 
           case "getemptymask":
           case "getemptymask":
-            return $el = $(actionObj.el), maskset = $el.data("_inputmask").maskset, opts = $el.data("_inputmask").opts, 
+            return el = actionObj.el, $el = $(el), maskset = el.inputmask.maskset, opts = el.inputmask.opts, 
             getBufferTemplate();
             getBufferTemplate();
 
 
           case "remove":
           case "remove":
-            var el = actionObj.el;
-            $el = $(el), maskset = $el.data("_inputmask").maskset, opts = $el.data("_inputmask").opts, 
-            el._valueSet(unmaskedvalue($el)), $el.unbind(".inputmask"), $el.removeData("_inputmask");
+            el = actionObj.el, $el = $(el), maskset = el.inputmask.maskset, opts = el.inputmask.opts, 
+            el._valueSet(unmaskedvalue($el)), $el.unbind(".inputmask"), el.inputmask = void 0;
             var valueProperty;
             var valueProperty;
             Object.getOwnPropertyDescriptor && (valueProperty = Object.getOwnPropertyDescriptor(el, "value")), 
             Object.getOwnPropertyDescriptor && (valueProperty = Object.getOwnPropertyDescriptor(el, "value")), 
             valueProperty && valueProperty.get ? el._valueGet && Object.defineProperty(el, "value", {
             valueProperty && valueProperty.get ? el._valueGet && Object.defineProperty(el, "value", {
@@ -1149,7 +1135,7 @@
             break;
             break;
 
 
           case "getmetadata":
           case "getmetadata":
-            if ($el = $(actionObj.el), maskset = $el.data("_inputmask").maskset, opts = $el.data("_inputmask").opts, 
+            if (el = actionObj.el, $el = $(el), maskset = el.inputmask.maskset, opts = el.inputmask.opts, 
             $.isArray(maskset.metadata)) {
             $.isArray(maskset.metadata)) {
                 for (var alternation, lvp = getLastValidPosition(), firstAlt = lvp; firstAlt >= 0; firstAlt--) if (getMaskSet().validPositions[firstAlt] && void 0 != getMaskSet().validPositions[firstAlt].alternation) {
                 for (var alternation, lvp = getLastValidPosition(), firstAlt = lvp; firstAlt >= 0; firstAlt--) if (getMaskSet().validPositions[firstAlt] && void 0 != getMaskSet().validPositions[firstAlt].alternation) {
                     alternation = getMaskSet().validPositions[firstAlt].alternation;
                     alternation = getMaskSet().validPositions[firstAlt].alternation;
@@ -1268,30 +1254,16 @@
             var specials = [ "/", ".", "*", "+", "?", "|", "(", ")", "[", "]", "{", "}", "\\", "$", "^" ];
             var specials = [ "/", ".", "*", "+", "?", "|", "(", ")", "[", "]", "{", "}", "\\", "$", "^" ];
             return str.replace(new RegExp("(\\" + specials.join("|\\") + ")", "gim"), "\\$1");
             return str.replace(new RegExp("(\\" + specials.join("|\\") + ")", "gim"), "\\$1");
         },
         },
-        format: function(value, options, metadata) {
-            var opts = $.extend(!0, {}, $.inputmask.defaults, options);
-            return resolveAlias(opts.alias, options, opts), maskScope({
-                action: "format",
-                value: value,
-                metadata: metadata
-            }, generateMaskSet(opts, options && void 0 !== options.definitions), opts);
-        },
-        isValid: function(value, options) {
-            var opts = $.extend(!0, {}, $.inputmask.defaults, options);
-            return resolveAlias(opts.alias, options, opts), maskScope({
-                action: "isValid",
-                value: value
-            }, generateMaskSet(opts, options && void 0 !== options.definitions), opts);
-        },
         mask: function(el) {
         mask: function(el) {
             var input = el.jquery && el.length > 0 ? el[0] : el;
             var input = el.jquery && el.length > 0 ? el[0] : el;
             importAttributeOptions(el, this.opts, this.userOptions);
             importAttributeOptions(el, this.opts, this.userOptions);
             var maskset = generateMaskSet(this.opts, this.noMasksCache);
             var maskset = generateMaskSet(this.opts, this.noMasksCache);
-            return void 0 != maskset && maskScope({
+            return void 0 != maskset && (input.inputmask = new inputmask(), input.inputmask.opts = this.opts, 
+            input.inputmask.noMasksCache = this.noMasksCache, input.inputmask.el = input, input.inputmask.maskset = maskset, 
+            input.inputmask.isRTL = !1, maskScope({
                 action: "mask",
                 action: "mask",
                 el: input
                 el: input
-            }, maskset, this.opts), input.inputmask = new inputmask(), input.inputmask.opts = this.opts, 
-            input.inputmask.noMasksCache = this.noMasksCache, input.inputmask.el = input, el;
+            }, maskset, this.opts)), el;
         },
         },
         unmaskedvalue: function() {
         unmaskedvalue: function() {
             return this.el ? maskScope({
             return this.el ? maskScope({
@@ -1333,6 +1305,19 @@
         $.extend(inputmask.prototype.defaults.definitions, definition);
         $.extend(inputmask.prototype.defaults.definitions, definition);
     }, inputmask.extendAliases = function(alias) {
     }, inputmask.extendAliases = function(alias) {
         $.extend(inputmask.prototype.defaults.aliases, alias);
         $.extend(inputmask.prototype.defaults.aliases, alias);
+    }, inputmask.format = function(value, options, metadata) {
+        var opts = $.extend(!0, {}, $.inputmask.defaults, options);
+        return resolveAlias(opts.alias, options, opts), maskScope({
+            action: "format",
+            value: value,
+            metadata: metadata
+        }, generateMaskSet(opts, options && void 0 !== options.definitions), opts);
+    }, inputmask.isValid = function(value, options) {
+        var opts = $.extend(!0, {}, $.inputmask.defaults, options);
+        return resolveAlias(opts.alias, options, opts), maskScope({
+            action: "isValid",
+            value: value
+        }, generateMaskSet(opts, options && void 0 !== options.definitions), opts);
     };
     };
     var ua = navigator.userAgent, iphone = null !== ua.match(new RegExp("iphone", "i")), androidchrome = (null !== ua.match(new RegExp("android.*safari.*", "i")), 
     var ua = navigator.userAgent, iphone = null !== ua.match(new RegExp("iphone", "i")), androidchrome = (null !== ua.match(new RegExp("android.*safari.*", "i")), 
     null !== ua.match(new RegExp("android.*chrome.*", "i"))), androidfirefox = null !== ua.match(new RegExp("android.*firefox.*", "i")), PasteEventType = (/Kindle/i.test(ua) || /Silk/i.test(ua) || /KFTT/i.test(ua) || /KFOT/i.test(ua) || /KFJWA/i.test(ua) || /KFJWI/i.test(ua) || /KFSOWI/i.test(ua) || /KFTHWA/i.test(ua) || /KFTHWI/i.test(ua) || /KFAPWA/i.test(ua) || /KFAPWI/i.test(ua), 
     null !== ua.match(new RegExp("android.*chrome.*", "i"))), androidfirefox = null !== ua.match(new RegExp("android.*firefox.*", "i")), PasteEventType = (/Kindle/i.test(ua) || /Silk/i.test(ua) || /KFTT/i.test(ua) || /KFOT/i.test(ua) || /KFJWA/i.test(ua) || /KFJWI/i.test(ua) || /KFSOWI/i.test(ua) || /KFTHWA/i.test(ua) || /KFTHWI/i.test(ua) || /KFAPWA/i.test(ua) || /KFAPWI/i.test(ua), 

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


+ 2 - 2
dist/inputmask/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.64-48
+* Version: 3.1.64-54
 */
 */
 !function(factory) {
 !function(factory) {
     "function" == typeof define && define.amd ? define([ "jquery", "./inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("jquery"), require("./inputmask")) : factory(jQuery);
     "function" == typeof define && define.amd ? define([ "jquery", "./inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("jquery"), require("./inputmask")) : factory(jQuery);
@@ -355,5 +355,5 @@
             digits: "0",
             digits: "0",
             radixPoint: ""
             radixPoint: ""
         }
         }
-    }), $.fn.inputmask;
+    }), inputmask;
 });
 });

File diff suppressed because it is too large
+ 2 - 2
dist/inputmask/inputmask.numeric.extensions.min.js


+ 2 - 2
dist/inputmask/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.64-48
+* Version: 3.1.64-54
 */
 */
 !function(factory) {
 !function(factory) {
     "function" == typeof define && define.amd ? define([ "jquery", "./inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("jquery"), require("./inputmask")) : factory(jQuery);
     "function" == typeof define && define.amd ? define([ "jquery", "./inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("jquery"), require("./inputmask")) : factory(jQuery);
@@ -44,5 +44,5 @@
             countrycode: "32",
             countrycode: "32",
             nojumpsThreshold: 4
             nojumpsThreshold: 4
         }
         }
-    }), $.fn.inputmask;
+    }), inputmask;
 });
 });

File diff suppressed because it is too large
+ 2 - 2
dist/inputmask/inputmask.phone.extensions.min.js


+ 2 - 2
dist/inputmask/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.64-48
+* Version: 3.1.64-54
 */
 */
 !function(factory) {
 !function(factory) {
     "function" == typeof define && define.amd ? define([ "jquery", "./inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("jquery"), require("./inputmask")) : factory(jQuery);
     "function" == typeof define && define.amd ? define([ "jquery", "./inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("jquery"), require("./inputmask")) : factory(jQuery);
@@ -120,5 +120,5 @@
                 }
                 }
             }
             }
         }
         }
-    }), $.fn.inputmask;
+    }), inputmask;
 });
 });

File diff suppressed because it is too large
+ 2 - 2
dist/inputmask/inputmask.regex.extensions.min.js


+ 1 - 1
dist/inputmask/jquery.inputmask.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.64-48
+* Version: 3.1.64-54
 */
 */
 !function(factory) {
 !function(factory) {
     "function" == typeof define && define.amd ? define([ "jquery", "./inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("jquery"), require("./inputmask")) : factory(jQuery);
     "function" == typeof define && define.amd ? define([ "jquery", "./inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("jquery"), require("./inputmask")) : factory(jQuery);

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


+ 50 - 65
dist/jquery.inputmask.bundle.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.64-48
+* Version: 3.1.64-54
 */
 */
 !function($) {
 !function($) {
     function inputmask(options) {
     function inputmask(options) {
@@ -667,7 +667,7 @@
             return $.inputmask.escapeRegex(str);
             return $.inputmask.escapeRegex(str);
         }
         }
         function unmaskedvalue($input) {
         function unmaskedvalue($input) {
-            if ($input.data("_inputmask") && !$input.hasClass("hasDatepicker")) {
+            if ($input[0].inputmask && !$input.hasClass("hasDatepicker")) {
                 var umValue = [], vps = getMaskSet().validPositions;
                 var umValue = [], vps = getMaskSet().validPositions;
                 for (var pndx in vps) vps[pndx].match && null != vps[pndx].match.fn && umValue.push(vps[pndx].input);
                 for (var pndx in vps) vps[pndx].match && null != vps[pndx].match.fn && umValue.push(vps[pndx].input);
                 var unmaskedValue = (isRTL ? umValue.reverse() : umValue).join(""), bufferValue = (isRTL ? getBuffer().slice().reverse() : getBuffer()).join("");
                 var unmaskedValue = (isRTL ? umValue.reverse() : umValue).join(""), bufferValue = (isRTL ? getBuffer().slice().reverse() : getBuffer()).join("");
@@ -800,17 +800,17 @@
                     };
                     };
                     $.valHooks[type] = {
                     $.valHooks[type] = {
                         get: function(elem) {
                         get: function(elem) {
-                            var $elem = $(elem);
-                            if ($elem.data("_inputmask")) {
-                                if ($elem.data("_inputmask").opts.autoUnmask) return $elem.inputmask("unmaskedvalue");
-                                var result = valhookGet(elem), inputData = $elem.data("_inputmask"), maskset = inputData.maskset, bufferTemplate = maskset._buffer;
+                            $(elem);
+                            if (elem.inputmask) {
+                                if (elem.inputmask.opts.autoUnmask) return elem.inputmask.unmaskedvalue();
+                                var result = valhookGet(elem), maskset = elem.inputmask.maskset, bufferTemplate = maskset._buffer;
                                 return bufferTemplate = bufferTemplate ? bufferTemplate.join("") : "", result != bufferTemplate ? result : "";
                                 return bufferTemplate = bufferTemplate ? bufferTemplate.join("") : "", result != bufferTemplate ? result : "";
                             }
                             }
                             return valhookGet(elem);
                             return valhookGet(elem);
                         },
                         },
                         set: function(elem, value) {
                         set: function(elem, value) {
-                            var result, $elem = $(elem), inputData = $elem.data("_inputmask");
-                            return result = valhookSet(elem, value), inputData && $elem.triggerHandler("setvalue.inputmask"), 
+                            var result, $elem = $(elem);
+                            return result = valhookSet(elem, value), elem.inputmask && $elem.triggerHandler("setvalue.inputmask"), 
                             result;
                             result;
                         },
                         },
                         inputmaskpatch: !0
                         inputmaskpatch: !0
@@ -818,12 +818,11 @@
                 }
                 }
             }
             }
             function getter() {
             function getter() {
-                var $self = $(this), inputData = $(this).data("_inputmask");
-                return inputData ? inputData.opts.autoUnmask ? $self.inputmask("unmaskedvalue") : valueGet.call(this) != getBufferTemplate().join("") ? valueGet.call(this) : "" : valueGet.call(this);
+                $(this);
+                return this.inputmask ? this.inputmask.opts.autoUnmask ? this.inputmask.unmaskedvalue() : valueGet.call(this) != getBufferTemplate().join("") ? valueGet.call(this) : "" : valueGet.call(this);
             }
             }
             function setter(value) {
             function setter(value) {
-                var inputData = $(this).data("_inputmask");
-                valueSet.call(this, value), inputData && $(this).triggerHandler("setvalue.inputmask");
+                valueSet.call(this, value), this.inputmask && $(this).triggerHandler("setvalue.inputmask");
             }
             }
             function InstallNativeValueSetFallback(npt) {
             function InstallNativeValueSetFallback(npt) {
                 $(npt).bind("mouseenter.inputmask", function(event) {
                 $(npt).bind("mouseenter.inputmask", function(event) {
@@ -1003,17 +1002,9 @@
         }
         }
         function compositionEndEvent(e) {}
         function compositionEndEvent(e) {}
         function mask(el) {
         function mask(el) {
-            if ($el = $(el), $el.data("_inputmask", {
-                maskset: maskset,
-                opts: opts,
-                isRTL: !1
-            }), opts.showTooltip && $el.prop("title", getMaskSet().mask), ("rtl" == el.dir || opts.rightAlign) && $el.css("text-align", "right"), 
-            "rtl" == el.dir || opts.numericInput) {
-                el.dir = "ltr", $el.removeAttr("dir");
-                var inputData = $el.data("_inputmask");
-                inputData.isRTL = !0, $el.data("_inputmask", inputData), isRTL = !0;
-            }
-            $el.unbind(".inputmask"), ($el.is(":input") && isInputTypeSupported($el.attr("type")) || el.isContentEditable) && ($el.closest("form").bind("submit", function(e) {
+            $el = $(el), opts.showTooltip && $el.prop("title", getMaskSet().mask), ("rtl" == el.dir || opts.rightAlign) && $el.css("text-align", "right"), 
+            ("rtl" == el.dir || opts.numericInput) && (el.dir = "ltr", $el.removeAttr("dir"), 
+            el.inputmask.isRTL = !0, isRTL = !0), $el.unbind(".inputmask"), ($el.is(":input") && isInputTypeSupported($el.attr("type")) || el.isContentEditable) && ($el.closest("form").bind("submit", function(e) {
                 undoValue != getBuffer().join("") && $el.change(), opts.clearMaskOnLostFocus && $el[0]._valueGet && $el[0]._valueGet() == getBufferTemplate().join("") && $el[0]._valueSet(""), 
                 undoValue != getBuffer().join("") && $el.change(), opts.clearMaskOnLostFocus && $el[0]._valueGet && $el[0]._valueGet() == getBufferTemplate().join("") && $el[0]._valueSet(""), 
                 opts.removeMaskOnSubmit && $el.inputmask("remove");
                 opts.removeMaskOnSubmit && $el.inputmask("remove");
             }).bind("reset", function() {
             }).bind("reset", function() {
@@ -1025,7 +1016,7 @@
                 !$input.is(":focus") && opts.showMaskOnHover && input._valueGet() != getBuffer().join("") && writeBuffer(input, getBuffer());
                 !$input.is(":focus") && opts.showMaskOnHover && input._valueGet() != getBuffer().join("") && writeBuffer(input, getBuffer());
             }).bind("blur.inputmask", function(e) {
             }).bind("blur.inputmask", function(e) {
                 var $input = $(this), input = this;
                 var $input = $(this), input = this;
-                if ($input.data("_inputmask")) {
+                if (input.inputmask) {
                     var nptValue = input._valueGet(), buffer = getBuffer().slice();
                     var nptValue = input._valueGet(), buffer = getBuffer().slice();
                     firstClick = !0, undoValue != buffer.join("") && setTimeout(function() {
                     firstClick = !0, undoValue != buffer.join("") && setTimeout(function() {
                         $input.change(), undoValue = buffer.join("");
                         $input.change(), undoValue = buffer.join("");
@@ -1089,23 +1080,21 @@
         var undoValue, compositionCaretPos, compositionData, $el, maxLength, isRTL = !1, skipKeyPressEvent = !1, skipInputEvent = !1, ignorable = !1, firstClick = !0;
         var undoValue, compositionCaretPos, compositionData, $el, maxLength, isRTL = !1, skipKeyPressEvent = !1, skipInputEvent = !1, ignorable = !1, firstClick = !0;
         if (void 0 != actionObj) switch (actionObj.action) {
         if (void 0 != actionObj) switch (actionObj.action) {
           case "isComplete":
           case "isComplete":
-            return $el = $(actionObj.el), maskset = $el.data("_inputmask").maskset, opts = $el.data("_inputmask").opts, 
+            return el = actionObj.el, $el = $(el), maskset = el.inputmask.maskset, opts = el.inputmask.opts, 
             isComplete(actionObj.buffer);
             isComplete(actionObj.buffer);
 
 
           case "unmaskedvalue":
           case "unmaskedvalue":
-            return $el = $(actionObj.el), maskset = $el.data("_inputmask").maskset, opts = $el.data("_inputmask").opts, 
-            isRTL = $el.data("_inputmask").isRTL, unmaskedvalue($el);
+            return el = actionObj.el, $el = $(el), maskset = el.inputmask.maskset, opts = el.inputmask.opts, 
+            isRTL = el.inputmask.isRTL, unmaskedvalue($el);
 
 
           case "mask":
           case "mask":
             undoValue = getBuffer().join(""), mask(actionObj.el);
             undoValue = getBuffer().join(""), mask(actionObj.el);
             break;
             break;
 
 
           case "format":
           case "format":
-            $el = $({}), $el.data("_inputmask", {
-                maskset: maskset,
-                opts: opts,
-                isRTL: opts.numericInput
-            }), opts.numericInput && (isRTL = !0);
+            $el = $({}), $el[0].inputmask = new inputmask(), $el[0].inputmask.opts = opts, $el[0].inputmask.el = $el[0], 
+            $el[0].inputmask.maskset = maskset, $el[0].inputmask.isRTL = opts.numericInput, 
+            opts.numericInput && (isRTL = !0);
             var valueBuffer = ($.isFunction(opts.onBeforeMask) ? opts.onBeforeMask.call($el, actionObj.value, opts) || actionObj.value : actionObj.value).split("");
             var valueBuffer = ($.isFunction(opts.onBeforeMask) ? opts.onBeforeMask.call($el, actionObj.value, opts) || actionObj.value : actionObj.value).split("");
             return checkVal($el, !1, !1, isRTL ? valueBuffer.reverse() : valueBuffer), $.isFunction(opts.onBeforeWrite) && opts.onBeforeWrite.call(this, void 0, getBuffer(), 0, opts), 
             return checkVal($el, !1, !1, isRTL ? valueBuffer.reverse() : valueBuffer), $.isFunction(opts.onBeforeWrite) && opts.onBeforeWrite.call(this, void 0, getBuffer(), 0, opts), 
             actionObj.metadata ? {
             actionObj.metadata ? {
@@ -1114,24 +1103,21 @@
             } : isRTL ? getBuffer().slice().reverse().join("") : getBuffer().join("");
             } : isRTL ? getBuffer().slice().reverse().join("") : getBuffer().join("");
 
 
           case "isValid":
           case "isValid":
-            $el = $({}), $el.data("_inputmask", {
-                maskset: maskset,
-                opts: opts,
-                isRTL: opts.numericInput
-            }), opts.numericInput && (isRTL = !0);
+            $el = $({}), $el[0].inputmask = new inputmask(), $el[0].inputmask.opts = opts, $el[0].inputmask.el = $el[0], 
+            $el[0].inputmask.maskset = maskset, $el[0].inputmask.isRTL = opts.numericInput, 
+            opts.numericInput && (isRTL = !0);
             var valueBuffer = actionObj.value.split("");
             var valueBuffer = actionObj.value.split("");
             checkVal($el, !1, !0, isRTL ? valueBuffer.reverse() : valueBuffer);
             checkVal($el, !1, !0, isRTL ? valueBuffer.reverse() : valueBuffer);
             for (var buffer = getBuffer(), rl = determineLastRequiredPosition(), lmib = buffer.length - 1; lmib > rl && !isMask(lmib); lmib--) ;
             for (var buffer = getBuffer(), rl = determineLastRequiredPosition(), lmib = buffer.length - 1; lmib > rl && !isMask(lmib); lmib--) ;
             return buffer.splice(rl, lmib + 1 - rl), isComplete(buffer) && actionObj.value == buffer.join("");
             return buffer.splice(rl, lmib + 1 - rl), isComplete(buffer) && actionObj.value == buffer.join("");
 
 
           case "getemptymask":
           case "getemptymask":
-            return $el = $(actionObj.el), maskset = $el.data("_inputmask").maskset, opts = $el.data("_inputmask").opts, 
+            return el = actionObj.el, $el = $(el), maskset = el.inputmask.maskset, opts = el.inputmask.opts, 
             getBufferTemplate();
             getBufferTemplate();
 
 
           case "remove":
           case "remove":
-            var el = actionObj.el;
-            $el = $(el), maskset = $el.data("_inputmask").maskset, opts = $el.data("_inputmask").opts, 
-            el._valueSet(unmaskedvalue($el)), $el.unbind(".inputmask"), $el.removeData("_inputmask");
+            el = actionObj.el, $el = $(el), maskset = el.inputmask.maskset, opts = el.inputmask.opts, 
+            el._valueSet(unmaskedvalue($el)), $el.unbind(".inputmask"), el.inputmask = void 0;
             var valueProperty;
             var valueProperty;
             Object.getOwnPropertyDescriptor && (valueProperty = Object.getOwnPropertyDescriptor(el, "value")), 
             Object.getOwnPropertyDescriptor && (valueProperty = Object.getOwnPropertyDescriptor(el, "value")), 
             valueProperty && valueProperty.get ? el._valueGet && Object.defineProperty(el, "value", {
             valueProperty && valueProperty.get ? el._valueGet && Object.defineProperty(el, "value", {
@@ -1147,7 +1133,7 @@
             break;
             break;
 
 
           case "getmetadata":
           case "getmetadata":
-            if ($el = $(actionObj.el), maskset = $el.data("_inputmask").maskset, opts = $el.data("_inputmask").opts, 
+            if (el = actionObj.el, $el = $(el), maskset = el.inputmask.maskset, opts = el.inputmask.opts, 
             $.isArray(maskset.metadata)) {
             $.isArray(maskset.metadata)) {
                 for (var alternation, lvp = getLastValidPosition(), firstAlt = lvp; firstAlt >= 0; firstAlt--) if (getMaskSet().validPositions[firstAlt] && void 0 != getMaskSet().validPositions[firstAlt].alternation) {
                 for (var alternation, lvp = getLastValidPosition(), firstAlt = lvp; firstAlt >= 0; firstAlt--) if (getMaskSet().validPositions[firstAlt] && void 0 != getMaskSet().validPositions[firstAlt].alternation) {
                     alternation = getMaskSet().validPositions[firstAlt].alternation;
                     alternation = getMaskSet().validPositions[firstAlt].alternation;
@@ -1266,30 +1252,16 @@
             var specials = [ "/", ".", "*", "+", "?", "|", "(", ")", "[", "]", "{", "}", "\\", "$", "^" ];
             var specials = [ "/", ".", "*", "+", "?", "|", "(", ")", "[", "]", "{", "}", "\\", "$", "^" ];
             return str.replace(new RegExp("(\\" + specials.join("|\\") + ")", "gim"), "\\$1");
             return str.replace(new RegExp("(\\" + specials.join("|\\") + ")", "gim"), "\\$1");
         },
         },
-        format: function(value, options, metadata) {
-            var opts = $.extend(!0, {}, $.inputmask.defaults, options);
-            return resolveAlias(opts.alias, options, opts), maskScope({
-                action: "format",
-                value: value,
-                metadata: metadata
-            }, generateMaskSet(opts, options && void 0 !== options.definitions), opts);
-        },
-        isValid: function(value, options) {
-            var opts = $.extend(!0, {}, $.inputmask.defaults, options);
-            return resolveAlias(opts.alias, options, opts), maskScope({
-                action: "isValid",
-                value: value
-            }, generateMaskSet(opts, options && void 0 !== options.definitions), opts);
-        },
         mask: function(el) {
         mask: function(el) {
             var input = el.jquery && el.length > 0 ? el[0] : el;
             var input = el.jquery && el.length > 0 ? el[0] : el;
             importAttributeOptions(el, this.opts, this.userOptions);
             importAttributeOptions(el, this.opts, this.userOptions);
             var maskset = generateMaskSet(this.opts, this.noMasksCache);
             var maskset = generateMaskSet(this.opts, this.noMasksCache);
-            return void 0 != maskset && maskScope({
+            return void 0 != maskset && (input.inputmask = new inputmask(), input.inputmask.opts = this.opts, 
+            input.inputmask.noMasksCache = this.noMasksCache, input.inputmask.el = input, input.inputmask.maskset = maskset, 
+            input.inputmask.isRTL = !1, maskScope({
                 action: "mask",
                 action: "mask",
                 el: input
                 el: input
-            }, maskset, this.opts), input.inputmask = new inputmask(), input.inputmask.opts = this.opts, 
-            input.inputmask.noMasksCache = this.noMasksCache, input.inputmask.el = input, el;
+            }, maskset, this.opts)), el;
         },
         },
         unmaskedvalue: function() {
         unmaskedvalue: function() {
             return this.el ? maskScope({
             return this.el ? maskScope({
@@ -1331,6 +1303,19 @@
         $.extend(inputmask.prototype.defaults.definitions, definition);
         $.extend(inputmask.prototype.defaults.definitions, definition);
     }, inputmask.extendAliases = function(alias) {
     }, inputmask.extendAliases = function(alias) {
         $.extend(inputmask.prototype.defaults.aliases, alias);
         $.extend(inputmask.prototype.defaults.aliases, alias);
+    }, inputmask.format = function(value, options, metadata) {
+        var opts = $.extend(!0, {}, $.inputmask.defaults, options);
+        return resolveAlias(opts.alias, options, opts), maskScope({
+            action: "format",
+            value: value,
+            metadata: metadata
+        }, generateMaskSet(opts, options && void 0 !== options.definitions), opts);
+    }, inputmask.isValid = function(value, options) {
+        var opts = $.extend(!0, {}, $.inputmask.defaults, options);
+        return resolveAlias(opts.alias, options, opts), maskScope({
+            action: "isValid",
+            value: value
+        }, generateMaskSet(opts, options && void 0 !== options.definitions), opts);
     };
     };
     var ua = navigator.userAgent, iphone = null !== ua.match(new RegExp("iphone", "i")), androidchrome = (null !== ua.match(new RegExp("android.*safari.*", "i")), 
     var ua = navigator.userAgent, iphone = null !== ua.match(new RegExp("iphone", "i")), androidchrome = (null !== ua.match(new RegExp("android.*safari.*", "i")), 
     null !== ua.match(new RegExp("android.*chrome.*", "i"))), androidfirefox = null !== ua.match(new RegExp("android.*firefox.*", "i")), PasteEventType = (/Kindle/i.test(ua) || /Silk/i.test(ua) || /KFTT/i.test(ua) || /KFOT/i.test(ua) || /KFJWA/i.test(ua) || /KFJWI/i.test(ua) || /KFSOWI/i.test(ua) || /KFTHWA/i.test(ua) || /KFTHWI/i.test(ua) || /KFAPWA/i.test(ua) || /KFAPWI/i.test(ua), 
     null !== ua.match(new RegExp("android.*chrome.*", "i"))), androidfirefox = null !== ua.match(new RegExp("android.*firefox.*", "i")), PasteEventType = (/Kindle/i.test(ua) || /Silk/i.test(ua) || /KFTT/i.test(ua) || /KFOT/i.test(ua) || /KFJWA/i.test(ua) || /KFJWI/i.test(ua) || /KFSOWI/i.test(ua) || /KFTHWA/i.test(ua) || /KFTHWI/i.test(ua) || /KFAPWA/i.test(ua) || /KFAPWI/i.test(ua), 
@@ -1834,7 +1819,7 @@
             separator: "/",
             separator: "/",
             alias: "mm/dd/yyyy"
             alias: "mm/dd/yyyy"
         }
         }
-    }), $.fn.inputmask;
+    }), inputmask;
 }(jQuery), function($) {
 }(jQuery), function($) {
     return inputmask.extendDefinitions({
     return inputmask.extendDefinitions({
         A: {
         A: {
@@ -1931,7 +1916,7 @@
                 }
                 }
             }
             }
         }
         }
-    }), $.fn.inputmask;
+    }), inputmask;
 }(jQuery), function($) {
 }(jQuery), function($) {
     return inputmask.extendAliases({
     return inputmask.extendAliases({
         numeric: {
         numeric: {
@@ -2280,7 +2265,7 @@
             digits: "0",
             digits: "0",
             radixPoint: ""
             radixPoint: ""
         }
         }
-    }), $.fn.inputmask;
+    }), inputmask;
 }(jQuery), function($) {
 }(jQuery), function($) {
     return inputmask.extendAliases({
     return inputmask.extendAliases({
         phone: {
         phone: {
@@ -2318,7 +2303,7 @@
             countrycode: "32",
             countrycode: "32",
             nojumpsThreshold: 4
             nojumpsThreshold: 4
         }
         }
-    }), $.fn.inputmask;
+    }), inputmask;
 }(jQuery), function($) {
 }(jQuery), function($) {
     return inputmask.extendAliases({
     return inputmask.extendAliases({
         Regex: {
         Regex: {
@@ -2432,5 +2417,5 @@
                 }
                 }
             }
             }
         }
         }
-    }), $.fn.inputmask;
+    }), inputmask;
 }(jQuery);
 }(jQuery);

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


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

@@ -599,5 +599,5 @@ Optional extensions on the jquery.inputmask base
     }
     }
   });
   });
 
 
-  return $.fn.inputmask;
+  return inputmask;
 })(jQuery);
 })(jQuery);

+ 1 - 1
js/inputmask.extensions.js

@@ -125,5 +125,5 @@ Optional extensions on the jquery.inputmask base
       }
       }
     }
     }
   });
   });
-  return $.fn.inputmask;
+  return inputmask;
 })(jQuery);
 })(jQuery);

+ 74 - 76
js/inputmask.js

@@ -128,39 +128,24 @@
       var specials = ['/', '.', '*', '+', '?', '|', '(', ')', '[', ']', '{', '}', '\\', '$', '^'];
       var specials = ['/', '.', '*', '+', '?', '|', '(', ')', '[', ']', '{', '}', '\\', '$', '^'];
       return str.replace(new RegExp('(\\' + specials.join('|\\') + ')', 'gim'), '\\$1');
       return str.replace(new RegExp('(\\' + specials.join('|\\') + ')', 'gim'), '\\$1');
     },
     },
-    format: function(value, options, metadata) {
-      var opts = $.extend(true, {}, $.inputmask.defaults, options);
-      resolveAlias(opts.alias, options, opts);
-      return maskScope({
-        "action": "format",
-        "value": value,
-        "metadata": metadata
-      }, generateMaskSet(opts, options && options.definitions !== undefined), opts);
-    },
-    isValid: function(value, options) {
-      var opts = $.extend(true, {}, $.inputmask.defaults, options);
-      resolveAlias(opts.alias, options, opts);
-      return maskScope({
-        "action": "isValid",
-        "value": value
-      }, generateMaskSet(opts, options && options.definitions !== undefined), opts);
-    },
     mask: function(el) {
     mask: function(el) {
       var input = el.jquery && el.length > 0 ? el[0] : el;
       var input = el.jquery && el.length > 0 ? el[0] : el;
       importAttributeOptions(el, this.opts, this.userOptions);
       importAttributeOptions(el, this.opts, this.userOptions);
       var maskset = generateMaskSet(this.opts, this.noMasksCache);
       var maskset = generateMaskSet(this.opts, this.noMasksCache);
       if (maskset != undefined) {
       if (maskset != undefined) {
+        //store inputmask instance on the input with element reference
+        input.inputmask = new inputmask();
+        input.inputmask.opts = this.opts;
+        input.inputmask.noMasksCache = this.noMasksCache;
+        input.inputmask.el = input;
+        input.inputmask.maskset = maskset;
+        input.inputmask.isRTL = false;
+
         maskScope({
         maskScope({
           "action": "mask",
           "action": "mask",
           "el": input
           "el": input
         }, maskset, this.opts);
         }, maskset, this.opts);
       }
       }
-      //store inputmask instance on the input with element reference
-      input.inputmask = new inputmask();
-      input.inputmask.opts = this.opts;
-      input.inputmask.noMasksCache = this.noMasksCache;
-      input.inputmask.el = input;
-
       return el;
       return el;
     },
     },
     unmaskedvalue: function() {
     unmaskedvalue: function() {
@@ -219,7 +204,25 @@
     $.extend(inputmask.prototype.defaults.definitions, definition);
     $.extend(inputmask.prototype.defaults.definitions, definition);
   }
   }
   inputmask.extendAliases = function(alias) {
   inputmask.extendAliases = function(alias) {
-    $.extend(inputmask.prototype.defaults.aliases, alias);
+      $.extend(inputmask.prototype.defaults.aliases, alias);
+    }
+    //static fn on inputmask
+  inputmask.format = function(value, options, metadata) {
+    var opts = $.extend(true, {}, $.inputmask.defaults, options);
+    resolveAlias(opts.alias, options, opts);
+    return maskScope({
+      "action": "format",
+      "value": value,
+      "metadata": metadata //true/false getmetadata
+    }, generateMaskSet(opts, options && options.definitions !== undefined), opts);
+  }
+  inputmask.isValid = function(value, options) {
+    var opts = $.extend(true, {}, $.inputmask.defaults, options);
+    resolveAlias(opts.alias, options, opts);
+    return maskScope({
+      "action": "isValid",
+      "value": value
+    }, generateMaskSet(opts, options && options.definitions !== undefined), opts);
   }
   }
 
 
   //helper functions
   //helper functions
@@ -1525,7 +1528,7 @@
     }
     }
 
 
     function unmaskedvalue($input) {
     function unmaskedvalue($input) {
-      if ($input.data('_inputmask') && !$input.hasClass('hasDatepicker')) {
+      if ($input[0].inputmask && !$input.hasClass('hasDatepicker')) {
         var umValue = [],
         var umValue = [],
           vps = getMaskSet()["validPositions"];
           vps = getMaskSet()["validPositions"];
         for (var pndx in vps) {
         for (var pndx in vps) {
@@ -1748,13 +1751,12 @@
           $.valHooks[type] = {
           $.valHooks[type] = {
             get: function(elem) {
             get: function(elem) {
               var $elem = $(elem);
               var $elem = $(elem);
-              if ($elem.data('_inputmask')) {
-                if ($elem.data('_inputmask')['opts'].autoUnmask)
-                  return $elem.inputmask('unmaskedvalue');
+              if (elem.inputmask) {
+                if (elem.inputmask.opts.autoUnmask)
+                  return elem.inputmask.unmaskedvalue();
                 else {
                 else {
                   var result = valhookGet(elem),
                   var result = valhookGet(elem),
-                    inputData = $elem.data('_inputmask'),
-                    maskset = inputData['maskset'],
+                    maskset = elem.inputmask.maskset,
                     bufferTemplate = maskset['_buffer'];
                     bufferTemplate = maskset['_buffer'];
                   bufferTemplate = bufferTemplate ? bufferTemplate.join('') : '';
                   bufferTemplate = bufferTemplate ? bufferTemplate.join('') : '';
                   return result != bufferTemplate ? result : '';
                   return result != bufferTemplate ? result : '';
@@ -1763,10 +1765,9 @@
             },
             },
             set: function(elem, value) {
             set: function(elem, value) {
               var $elem = $(elem),
               var $elem = $(elem),
-                inputData = $elem.data('_inputmask'),
                 result;
                 result;
               result = valhookSet(elem, value);
               result = valhookSet(elem, value);
-              if (inputData)
+              if (elem.inputmask)
                 $elem.triggerHandler('setvalue.inputmask');
                 $elem.triggerHandler('setvalue.inputmask');
               return result;
               return result;
             },
             },
@@ -1776,17 +1777,15 @@
       }
       }
 
 
       function getter() {
       function getter() {
-        var $self = $(this),
-          inputData = $(this).data('_inputmask');
-        if (inputData) {
-          return inputData['opts'].autoUnmask ? $self.inputmask('unmaskedvalue') : (valueGet.call(this) != getBufferTemplate().join('') ? valueGet.call(this) : '');
+        var $self = $(this);
+        if (this.inputmask) {
+          return this.inputmask.opts.autoUnmask ? this.inputmask.unmaskedvalue() : (valueGet.call(this) != getBufferTemplate().join('') ? valueGet.call(this) : '');
         } else return valueGet.call(this);
         } else return valueGet.call(this);
       }
       }
 
 
       function setter(value) {
       function setter(value) {
-        var inputData = $(this).data('_inputmask');
         valueSet.call(this, value);
         valueSet.call(this, value);
-        if (inputData)
+        if (this.inputmask)
           $(this).triggerHandler('setvalue.inputmask');
           $(this).triggerHandler('setvalue.inputmask');
       }
       }
 
 
@@ -2209,13 +2208,6 @@
     function mask(el) {
     function mask(el) {
       $el = $(el);
       $el = $(el);
 
 
-      //store tests & original buffer in the input element - used to get the unmasked value
-      $el.data('_inputmask', {
-        'maskset': maskset,
-        'opts': opts,
-        'isRTL': false
-      });
-
       //show tooltip
       //show tooltip
       if (opts.showTooltip) {
       if (opts.showTooltip) {
         $el.prop("title", getMaskSet()["mask"]);
         $el.prop("title", getMaskSet()["mask"]);
@@ -2227,9 +2219,7 @@
       if (el.dir == "rtl" || opts.numericInput) {
       if (el.dir == "rtl" || opts.numericInput) {
         el.dir = "ltr";
         el.dir = "ltr";
         $el.removeAttr("dir");
         $el.removeAttr("dir");
-        var inputData = $el.data('_inputmask');
-        inputData['isRTL'] = true;
-        $el.data('_inputmask', inputData);
+        el.inputmask.isRTL = true;
         isRTL = true;
         isRTL = true;
       }
       }
 
 
@@ -2264,7 +2254,7 @@
         }).bind("blur.inputmask", function(e) {
         }).bind("blur.inputmask", function(e) {
           var $input = $(this),
           var $input = $(this),
             input = this;
             input = this;
-          if ($input.data('_inputmask')) {
+          if (input.inputmask) {
             var nptValue = input._valueGet(),
             var nptValue = input._valueGet(),
               buffer = getBuffer().slice();
               buffer = getBuffer().slice();
             firstClick = true;
             firstClick = true;
@@ -2429,15 +2419,17 @@
     if (actionObj != undefined) {
     if (actionObj != undefined) {
       switch (actionObj["action"]) {
       switch (actionObj["action"]) {
         case "isComplete":
         case "isComplete":
-          $el = $(actionObj["el"]);
-          maskset = $el.data('_inputmask')['maskset'];
-          opts = $el.data('_inputmask')['opts'];
+          el = actionObj["el"]
+          $el = $(el);
+          maskset = el.inputmask.maskset;
+          opts = el.inputmask.opts;
           return isComplete(actionObj["buffer"]);
           return isComplete(actionObj["buffer"]);
         case "unmaskedvalue":
         case "unmaskedvalue":
-          $el = $(actionObj["el"]);
-          maskset = $el.data('_inputmask')['maskset'];
-          opts = $el.data('_inputmask')['opts'];
-          isRTL = $el.data('_inputmask')['isRTL'];
+          el = actionObj["el"]
+          $el = $(el);
+          maskset = el.inputmask.maskset;
+          opts = el.inputmask.opts;
+          isRTL = el.inputmask.isRTL;
           return unmaskedvalue($el);
           return unmaskedvalue($el);
         case "mask":
         case "mask":
           undoValue = getBuffer().join('');
           undoValue = getBuffer().join('');
@@ -2445,11 +2437,13 @@
           break;
           break;
         case "format":
         case "format":
           $el = $({});
           $el = $({});
-          $el.data('_inputmask', {
-            'maskset': maskset,
-            'opts': opts,
-            'isRTL': opts.numericInput
-          });
+          //store inputmask instance on the input with element reference
+          $el[0].inputmask = new inputmask();
+          $el[0].inputmask.opts = opts;
+          $el[0].inputmask.el = $el[0];
+          $el[0].inputmask.maskset = maskset;
+          $el[0].inputmask.isRTL = opts.numericInput;
+
           if (opts.numericInput) {
           if (opts.numericInput) {
             isRTL = true;
             isRTL = true;
           }
           }
@@ -2467,11 +2461,13 @@
           return isRTL ? getBuffer().slice().reverse().join('') : getBuffer().join('');
           return isRTL ? getBuffer().slice().reverse().join('') : getBuffer().join('');
         case "isValid":
         case "isValid":
           $el = $({});
           $el = $({});
-          $el.data('_inputmask', {
-            'maskset': maskset,
-            'opts': opts,
-            'isRTL': opts.numericInput
-          });
+          //store inputmask instance on the input with element reference
+          $el[0].inputmask = new inputmask();
+          $el[0].inputmask.opts = opts;
+          $el[0].inputmask.el = $el[0];
+          $el[0].inputmask.maskset = maskset;
+          $el[0].inputmask.isRTL = opts.numericInput;
+
           if (opts.numericInput) {
           if (opts.numericInput) {
             isRTL = true;
             isRTL = true;
           }
           }
@@ -2487,21 +2483,22 @@
 
 
           return isComplete(buffer) && actionObj["value"] == buffer.join('');
           return isComplete(buffer) && actionObj["value"] == buffer.join('');
         case "getemptymask":
         case "getemptymask":
-          $el = $(actionObj["el"]);
-          maskset = $el.data('_inputmask')['maskset'];
-          opts = $el.data('_inputmask')['opts'];
+          el = actionObj["el"]
+          $el = $(el);
+          maskset = el.inputmask.maskset;
+          opts = el.inputmask.opts;
           return getBufferTemplate();
           return getBufferTemplate();
         case "remove":
         case "remove":
-          var el = actionObj["el"];
+          el = actionObj["el"]
           $el = $(el);
           $el = $(el);
-          maskset = $el.data('_inputmask')['maskset'];
-          opts = $el.data('_inputmask')['opts'];
+          maskset = el.inputmask.maskset;
+          opts = el.inputmask.opts;
           //writeout the unmaskedvalue
           //writeout the unmaskedvalue
           el._valueSet(unmaskedvalue($el));
           el._valueSet(unmaskedvalue($el));
           //unbind all events
           //unbind all events
           $el.unbind(".inputmask");
           $el.unbind(".inputmask");
           //clear data
           //clear data
-          $el.removeData('_inputmask');
+          el.inputmask = undefined;
           //restore the value property
           //restore the value property
           var valueProperty;
           var valueProperty;
           if (Object.getOwnPropertyDescriptor)
           if (Object.getOwnPropertyDescriptor)
@@ -2529,9 +2526,10 @@
           }
           }
           break;
           break;
         case "getmetadata":
         case "getmetadata":
-          $el = $(actionObj["el"]);
-          maskset = $el.data('_inputmask')['maskset'];
-          opts = $el.data('_inputmask')['opts'];
+          el = actionObj["el"]
+          $el = $(el);
+          maskset = el.inputmask.maskset;
+          opts = el.inputmask.opts;
           if ($.isArray(maskset["metadata"])) {
           if ($.isArray(maskset["metadata"])) {
             //find last alternation
             //find last alternation
             var alternation, lvp = getLastValidPosition();
             var alternation, lvp = getLastValidPosition();

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

@@ -591,5 +591,5 @@ Optional extensions on the jquery.inputmask base
       radixPoint: ""
       radixPoint: ""
     }
     }
   });
   });
-  return $.fn.inputmask;
+  return inputmask;
 })(jQuery);
 })(jQuery);

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

@@ -62,5 +62,5 @@ When using this extension make sure you specify the correct url to get the masks
       nojumpsThreshold: 4
       nojumpsThreshold: 4
     }
     }
   });
   });
-  return $.fn.inputmask;
+  return inputmask;
 })(jQuery);
 })(jQuery);

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

@@ -199,5 +199,5 @@ Allows for using regular expressions as a mask
       }
       }
     }
     }
   });
   });
-  return $.fn.inputmask;
+  return inputmask;
 })(jQuery);
 })(jQuery);

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
 {
   "name": "jquery.inputmask",
   "name": "jquery.inputmask",
-  "version": "3.1.64-48",
+  "version": "3.1.64-54",
   "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": [

+ 99 - 87
qunit/simulator.js

@@ -1,94 +1,106 @@
-(function ($) {
-    $.caret = function (input, begin, end) {
-        var npt = input.jquery && input.length > 0 ? input[0] : input, range;
-        if (typeof begin == 'number') {
-            if (!$(input).is(':visible')) {
-                return;
-            }
-            end = (typeof end == 'number') ? end : begin;
-            if (npt.setSelectionRange) {
-                npt.selectionStart = begin;
-                npt.selectionEnd = end;
+(function($) {
+  $.caret = function(input, begin, end) {
+    var npt = input.jquery && input.length > 0 ? input[0] : input,
+      range;
+    if (typeof begin == 'number') {
+      if (!$(input).is(':visible')) {
+        return;
+      }
+      end = (typeof end == 'number') ? end : begin;
+      if (npt.setSelectionRange) {
+        npt.selectionStart = begin;
+        npt.selectionEnd = end;
 
 
-            } else if (npt.createTextRange) {
-                range = npt.createTextRange();
-                range.collapse(true);
-                range.moveEnd('character', end);
-                range.moveStart('character', begin);
-                range.select();
-            }
-        } else {
-            if (!$(input).is(':visible')) {
-                return { "begin": 0, "end": 0 };
-            }
-            if (npt.setSelectionRange) {
-                begin = npt.selectionStart;
-                end = npt.selectionEnd;
-            } else if (document.selection && document.selection.createRange) {
-                range = document.selection.createRange();
-                begin = 0 - range.duplicate().moveStart('character', -100000);
-                end = begin + range.text.length;
-            }
-            return { "begin": begin, "end": end };
+      } else if (npt.createTextRange) {
+        range = npt.createTextRange();
+        range.collapse(true);
+        range.moveEnd('character', end);
+        range.moveStart('character', begin);
+        range.select();
+      }
+    } else {
+      if (!$(input).is(':visible')) {
+        return {
+          "begin": 0,
+          "end": 0
+        };
+      }
+      if (npt.setSelectionRange) {
+        begin = npt.selectionStart;
+        end = npt.selectionEnd;
+      } else if (document.selection && document.selection.createRange) {
+        range = document.selection.createRange();
+        begin = 0 - range.duplicate().moveStart('character', -100000);
+        end = begin + range.text.length;
+      }
+      return {
+        "begin": begin,
+        "end": end
+      };
+    }
+  };
+  $.fn.SendKey = function(keyCode, modifier) {
+    var sendDummyKeydown = false;
+    if (Object.prototype.toString.call(keyCode) == '[object String]') {
+      keyCode = keyCode.charCodeAt(0);
+      sendDummyKeydown = true;
+    }
+
+    switch (keyCode) {
+      case $.inputmask.keyCode.LEFT:
+        {
+          if (modifier == undefined) {
+            var pos = $.caret(this);
+            $.caret(this, pos.begin - 1);
+            break;
+          }
         }
         }
-    };
-    $.fn.SendKey = function (keyCode, modifier) {
-        var sendDummyKeydown = false;
-        if (Object.prototype.toString.call(keyCode) == '[object String]') {
-            keyCode = keyCode.charCodeAt(0);
-            sendDummyKeydown = true;
+      case $.inputmask.keyCode.RIGHT:
+        {
+          if (modifier == undefined) {
+            var pos = $.caret(this);
+            $.caret(this, pos.begin + 1);
+            break;
+          }
         }
         }
+      default:
+        {
+          var keydown = $.Event("keydown"),
+            keypress = $.Event("keypress"),
+            keyup = $.Event("keyup");
 
 
-        switch (keyCode) {
-            case $.inputmask.keyCode.LEFT: {
-                if (modifier == undefined) {
-                    var pos = $.caret(this);
-                    $.caret(this, pos.begin - 1);
-                    break;
-                }
-            }
-            case $.inputmask.keyCode.RIGHT: {
-                if (modifier == undefined) {
-                    var pos = $.caret(this);
-                    $.caret(this, pos.begin + 1);
-                    break;
-                }
-            }
-            default: {
-                var keydown = $.Event("keydown"),
-                    keypress = $.Event("keypress"),
-                    keyup = $.Event("keyup");
-
-                if (!sendDummyKeydown) {
-                    keydown.keyCode = keyCode;
-                    if (modifier == $.inputmask.keyCode.CONTROL)
-                        keydown.ctrlKey = true;
-                }
-                $(this).trigger(keydown);
-                if (!keydown.isDefaultPrevented()) {
-                    keypress.keyCode = keyCode;
-                    if (modifier == $.inputmask.keyCode.CONTROL)
-                        keypress.ctrlKey = true;
-                    $(this).trigger(keypress);
-                    //if (!keypress.isDefaultPrevented()) {
-                    keyup.keyCode = keyCode;
-                    if (modifier == $.inputmask.keyCode.CONTROL)
-                        keyup.ctrlKey = true;
-                    $(this).trigger(keyup);
-                    //}
-                }
-            }
+          if (!sendDummyKeydown) {
+            keydown.keyCode = keyCode;
+            if (modifier == $.inputmask.keyCode.CONTROL)
+              keydown.ctrlKey = true;
+          }
+          $(this).trigger(keydown);
+          if (!keydown.isDefaultPrevented()) {
+            keypress.keyCode = keyCode;
+            if (modifier == $.inputmask.keyCode.CONTROL)
+              keypress.ctrlKey = true;
+            $(this).trigger(keypress);
+            //if (!keypress.isDefaultPrevented()) {
+            keyup.keyCode = keyCode;
+            if (modifier == $.inputmask.keyCode.CONTROL)
+              keyup.ctrlKey = true;
+            $(this).trigger(keyup);
+            //}
+          }
         }
         }
     }
     }
-    $.fn.Type = function (inputStr) {
-        var $input = $(this);
-        $.each(inputStr.split(''), function (ndx, lmnt) {
-            $input.SendKey(lmnt);
-        });
-    }
-    $.fn.paste = function (inputStr) {
-        var $input = $(this), isRTL = $input.data("_inputmask").isRTL;
-        window.clipboardData ? window.clipboardData.setData("Text", inputStr) : $input[0]._valueSet(isRTL ? inputStr.split('').reverse().join('') : inputStr);
-        $input.trigger('paste');
-    }
+  }
+  $.fn.Type = function(inputStr) {
+    var $input = $(this);
+    $.each(inputStr.split(''), function(ndx, lmnt) {
+      $input.SendKey(lmnt);
+    });
+  }
+  $.fn.paste = function(inputStr) {
+    var input = this.jquery && this.length > 0 ? this[0] : this,
+      $input = $(input),
+      isRTL = input.inputmask.isRTL;
+    window.clipboardData ? window.clipboardData.setData("Text", inputStr) : $input[0]._valueSet(isRTL ? inputStr.split('').reverse().join('') : inputStr);
+    $input.trigger('paste');
+  }
 })(jQuery);
 })(jQuery);

+ 37 - 37
qunit/tests_formatvalidate.js

@@ -1,22 +1,22 @@
 module("Value formatting");
 module("Value formatting");
-test("$.inputmask.format(\"2331973\", { alias: \"date\"})", function () {
-    var formattedValue = $.inputmask.format("2331973", { alias: "date" });
+test("inputmask.format(\"2331973\", { alias: \"date\"})", function () {
+    var formattedValue = inputmask.format("2331973", { alias: "date" });
     equal(formattedValue, "23/03/1973", "Result " + formattedValue);
     equal(formattedValue, "23/03/1973", "Result " + formattedValue);
 });
 });
 
 
-test("$.inputmask.format(\"016501030020001DE1015170\", { mask: \"99 999 999 999 9999 \\D\\E*** 9999\"})", function () {
-    var formattedValue = $.inputmask.format("016501030020001DE1015170", { mask: "99 999 999 999 9999 \\D\\E*** 9999" });
+test("inputmask.format(\"016501030020001DE1015170\", { mask: \"99 999 999 999 9999 \\D\\E*** 9999\"})", function () {
+    var formattedValue = inputmask.format("016501030020001DE1015170", { mask: "99 999 999 999 9999 \\D\\E*** 9999" });
     equal(formattedValue, "01 650 103 002 0001 DE101 5170", "Result " + formattedValue);
     equal(formattedValue, "01 650 103 002 0001 DE101 5170", "Result " + formattedValue);
 });
 });
 
 
-test("$.inputmask.format(\"12\", {  mask: \"$ 999999\", numericInput: true, placeholder: \"0\" }); - gigermocas", function () {
-    var formattedValue = $.inputmask.format("12", { mask: "$ 999999", numericInput: true, placeholder: "0" });
+test("inputmask.format(\"12\", {  mask: \"$ 999999\", numericInput: true, placeholder: \"0\" }); - gigermocas", function () {
+    var formattedValue = inputmask.format("12", { mask: "$ 999999", numericInput: true, placeholder: "0" });
     equal(formattedValue, "$ 000012", "Result " + formattedValue);
     equal(formattedValue, "$ 000012", "Result " + formattedValue);
 });
 });
 
 
 
 
-test("$.inputmask.format(\"1111111.11\" - ... autoGroup: true - swd120", function () {
-    var formattedValue = $.inputmask.format("1111111.11", {
+test("inputmask.format(\"1111111.11\" - ... autoGroup: true - swd120", function () {
+    var formattedValue = inputmask.format("1111111.11", {
         alias: "decimal",
         alias: "decimal",
         radixPoint: ".",
         radixPoint: ".",
         digits: 2,
         digits: 2,
@@ -28,66 +28,66 @@ test("$.inputmask.format(\"1111111.11\" - ... autoGroup: true - swd120", functio
     equal(formattedValue, "1,111,111.11", "Result " + formattedValue);
     equal(formattedValue, "1,111,111.11", "Result " + formattedValue);
 });
 });
 
 
-test("$.inputmask.format(phone, { mask: '(999) 999-9999' })); - krivaten", function () {
+test("inputmask.format(phone, { mask: '(999) 999-9999' })); - krivaten", function () {
     var phone = '5551112222';
     var phone = '5551112222';
-    var formattedValue = $.inputmask.format(phone, { mask: '(999) 999-9999' });
+    var formattedValue = inputmask.format(phone, { mask: '(999) 999-9999' });
     equal(formattedValue, "(555) 111-2222", "Result " + formattedValue);
     equal(formattedValue, "(555) 111-2222", "Result " + formattedValue);
 });
 });
 
 
 
 
 module("Value Validating");
 module("Value Validating");
-test("$.inputmask.isValid(\"23/03/1973\", { alias: \"date\"})", function () {
-    var isValid = $.inputmask.isValid("23/03/1973", { alias: "date" });
+test("inputmask.isValid(\"23/03/1973\", { alias: \"date\"})", function () {
+    var isValid = inputmask.isValid("23/03/1973", { alias: "date" });
     equal(isValid, true, "Result " + isValid);
     equal(isValid, true, "Result " + isValid);
 });
 });
 
 
-test("$.inputmask.isValid(\"01 650 103 002 0001 DE101 5170\", { mask: \"99 999 999 999 9999 \\D\\E*** 9999\"})", function () {
-    var isValid = $.inputmask.isValid("01 650 103 002 0001 DE101 5170", { mask: "99 999 999 999 9999 \\D\\E*** 9999" });
+test("inputmask.isValid(\"01 650 103 002 0001 DE101 5170\", { mask: \"99 999 999 999 9999 \\D\\E*** 9999\"})", function () {
+    var isValid = inputmask.isValid("01 650 103 002 0001 DE101 5170", { mask: "99 999 999 999 9999 \\D\\E*** 9999" });
     equal(isValid, true, "Result " + isValid);
     equal(isValid, true, "Result " + isValid);
 });
 });
 
 
-test("$.inputmask.isValid email => false", function () {
-    var isValid = $.inputmask.isValid("some.body@mail.c", { alias: "email" });
+test("inputmask.isValid email => false", function () {
+    var isValid = inputmask.isValid("some.body@mail.c", { alias: "email" });
     equal(isValid, true, "Result " + isValid);
     equal(isValid, true, "Result " + isValid);
 });
 });
 
 
-test("$.inputmask.isValid email => true", function () {
-    var isValid = $.inputmask.isValid("some.body@mail.com", { alias: "email" });
+test("inputmask.isValid email => true", function () {
+    var isValid = inputmask.isValid("some.body@mail.com", { alias: "email" });
     equal(isValid, true, "Result " + isValid);
     equal(isValid, true, "Result " + isValid);
 });
 });
 
 
-test("$.inputmask.isValid email greedy => false", function () {
-    var isValid = $.inputmask.isValid("some.body@mail.c", { alias: "email", greedy: true });
+test("inputmask.isValid email greedy => false", function () {
+    var isValid = inputmask.isValid("some.body@mail.c", { alias: "email", greedy: true });
     equal(isValid, true, "Result " + isValid);
     equal(isValid, true, "Result " + isValid);
 });
 });
 
 
-test("$.inputmask.isValid email greedy => true", function () {
-    var isValid = $.inputmask.isValid("some.body@mail.com", { alias: "email", greedy: true });
+test("inputmask.isValid email greedy => true", function () {
+    var isValid = inputmask.isValid("some.body@mail.com", { alias: "email", greedy: true });
     equal(isValid, true, "Result " + isValid);
     equal(isValid, true, "Result " + isValid);
 });
 });
 
 
 test("YoussefTaghlabi isValid(\"100\", { alias: \"integer\" }", function () {
 test("YoussefTaghlabi isValid(\"100\", { alias: \"integer\" }", function () {
-    var isValid = $.inputmask.isValid("100", { alias: "integer" });
+    var isValid = inputmask.isValid("100", { alias: "integer" });
     equal(isValid, true, "Result " + isValid);
     equal(isValid, true, "Result " + isValid);
 });
 });
 test("YoussefTaghlabi isValid(\"100.00\", { alias: \"integer\" }", function () {
 test("YoussefTaghlabi isValid(\"100.00\", { alias: \"integer\" }", function () {
-    var isValid = $.inputmask.isValid("100.00", { alias: "integer" });
+    var isValid = inputmask.isValid("100.00", { alias: "integer" });
     equal(isValid, false, "Result " + isValid);
     equal(isValid, false, "Result " + isValid);
 });
 });
 test("YoussefTaghlabi isValid(\"123\", { alias: \"decimal\" }", function () {
 test("YoussefTaghlabi isValid(\"123\", { alias: \"decimal\" }", function () {
-    var isValid = $.inputmask.isValid("123", { alias: "decimal" });
+    var isValid = inputmask.isValid("123", { alias: "decimal" });
     equal(isValid, true, "Result " + isValid);
     equal(isValid, true, "Result " + isValid);
 });
 });
 test("YoussefTaghlabi isValid(\"123.45\", { alias: \"decimal\" }", function () {
 test("YoussefTaghlabi isValid(\"123.45\", { alias: \"decimal\" }", function () {
-    var isValid = $.inputmask.isValid("123.45", { alias: "decimal" });
+    var isValid = inputmask.isValid("123.45", { alias: "decimal" });
     equal(isValid, true, "Result " + isValid);
     equal(isValid, true, "Result " + isValid);
 });
 });
 test("YoussefTaghlabi isValid(\"123456.78\", { alias: \"decimal\" }", function () {
 test("YoussefTaghlabi isValid(\"123456.78\", { alias: \"decimal\" }", function () {
-    var isValid = $.inputmask.isValid("123456.78", { alias: "decimal" });
+    var isValid = inputmask.isValid("123456.78", { alias: "decimal" });
     equal(isValid, true, "Result " + isValid);
     equal(isValid, true, "Result " + isValid);
 });
 });
 test("YoussefTaghlabi isValid(\"123,456.78\", { alias: \"decimal\" }", function () {
 test("YoussefTaghlabi isValid(\"123,456.78\", { alias: \"decimal\" }", function () {
-    var isValid = $.inputmask.isValid("123,456.78", {
+    var isValid = inputmask.isValid("123,456.78", {
         alias: "decimal", radixPoint: ".",
         alias: "decimal", radixPoint: ".",
         groupSeparator: ",",
         groupSeparator: ",",
         groupSize: 3
         groupSize: 3
@@ -95,7 +95,7 @@ test("YoussefTaghlabi isValid(\"123,456.78\", { alias: \"decimal\" }", function
     equal(isValid, true, "Result " + isValid);
     equal(isValid, true, "Result " + isValid);
 });
 });
 test("YoussefTaghlabi isValid(\"12,\", { alias: \"decimal\" }", function () {
 test("YoussefTaghlabi isValid(\"12,\", { alias: \"decimal\" }", function () {
-    var isValid = $.inputmask.isValid("12,", {
+    var isValid = inputmask.isValid("12,", {
         alias: "decimal", radixPoint: ".",
         alias: "decimal", radixPoint: ".",
         groupSeparator: ",",
         groupSeparator: ",",
         groupSize: 3
         groupSize: 3
@@ -103,7 +103,7 @@ test("YoussefTaghlabi isValid(\"12,\", { alias: \"decimal\" }", function () {
     equal(isValid, false, "Result " + isValid);
     equal(isValid, false, "Result " + isValid);
 });
 });
 test("YoussefTaghlabi isValid(\"12,1.45\", { alias: \"decimal\" }", function () {
 test("YoussefTaghlabi isValid(\"12,1.45\", { alias: \"decimal\" }", function () {
-    var isValid = $.inputmask.isValid("12,1.45", {
+    var isValid = inputmask.isValid("12,1.45", {
         alias: "decimal", radixPoint: ".",
         alias: "decimal", radixPoint: ".",
         groupSeparator: ",",
         groupSeparator: ",",
         groupSize: 3
         groupSize: 3
@@ -111,7 +111,7 @@ test("YoussefTaghlabi isValid(\"12,1.45\", { alias: \"decimal\" }", function ()
     equal(isValid, false, "Result " + isValid);
     equal(isValid, false, "Result " + isValid);
 });
 });
 test("YoussefTaghlabi isValid(\"12,345.67\", { alias: \"decimal\" }", function () {
 test("YoussefTaghlabi isValid(\"12,345.67\", { alias: \"decimal\" }", function () {
-    var isValid = $.inputmask.isValid("12,345.67", {
+    var isValid = inputmask.isValid("12,345.67", {
         alias: "decimal", radixPoint: ".",
         alias: "decimal", radixPoint: ".",
         groupSeparator: ",",
         groupSeparator: ",",
         groupSize: 3
         groupSize: 3
@@ -120,26 +120,26 @@ test("YoussefTaghlabi isValid(\"12,345.67\", { alias: \"decimal\" }", function (
 });
 });
 
 
 test("thomstark isValid(\"12lbs\", {mask:\"99[9]lb\\s\", greedy:false, skipOptionalPartCharacter: \"\", \"clearIncomplete\":true}", function () {
 test("thomstark isValid(\"12lbs\", {mask:\"99[9]lb\\s\", greedy:false, skipOptionalPartCharacter: \"\", \"clearIncomplete\":true}", function () {
-    var isValid = $.inputmask.isValid("12lbs", { mask: "99[9]lb\\s", greedy: false, skipOptionalPartCharacter: "", "clearIncomplete": true });
+    var isValid = inputmask.isValid("12lbs", { mask: "99[9]lb\\s", greedy: false, skipOptionalPartCharacter: "", "clearIncomplete": true });
     equal(isValid, true, "Result " + isValid);
     equal(isValid, true, "Result " + isValid);
 });
 });
 
 
 test("thomstark isValid(\"1'2\"\", {mask:\"9'9[9]\"\", greedy:false, skipOptionalPartCharacter: \"\", \"clearIncomplete\":true}", function () {
 test("thomstark isValid(\"1'2\"\", {mask:\"9'9[9]\"\", greedy:false, skipOptionalPartCharacter: \"\", \"clearIncomplete\":true}", function () {
-    var isValid = $.inputmask.isValid("1'2\"", { mask: "9'9[9]\"", greedy: false, skipOptionalPartCharacter: "", "clearIncomplete": true });
+    var isValid = inputmask.isValid("1'2\"", { mask: "9'9[9]\"", greedy: false, skipOptionalPartCharacter: "", "clearIncomplete": true });
     equal(isValid, true, "Result " + isValid);
     equal(isValid, true, "Result " + isValid);
 });
 });
 
 
 test("thomstark isValid(\"12lbs\", {mask:\"99{1,2}lb\\s\", greedy:false, skipOptionalPartCharacter: \"\", \"clearIncomplete\":true}", function () {
 test("thomstark isValid(\"12lbs\", {mask:\"99{1,2}lb\\s\", greedy:false, skipOptionalPartCharacter: \"\", \"clearIncomplete\":true}", function () {
-    var isValid = $.inputmask.isValid("12lbs", { mask: "99{1,2}lb\\s", greedy: false, skipOptionalPartCharacter: "", "clearIncomplete": true });
+    var isValid = inputmask.isValid("12lbs", { mask: "99{1,2}lb\\s", greedy: false, skipOptionalPartCharacter: "", "clearIncomplete": true });
     equal(isValid, true, "Result " + isValid);
     equal(isValid, true, "Result " + isValid);
 });
 });
 
 
 test("thomstark isValid(\"9'9{1,2}\", {mask:\"9'9[9]\"\", greedy:false, skipOptionalPartCharacter: \"\", \"clearIncomplete\":true}", function () {
 test("thomstark isValid(\"9'9{1,2}\", {mask:\"9'9[9]\"\", greedy:false, skipOptionalPartCharacter: \"\", \"clearIncomplete\":true}", function () {
-    var isValid = $.inputmask.isValid("1'2\"", { mask: "9'9{1,2}\"", greedy: false, skipOptionalPartCharacter: "", "clearIncomplete": true });
+    var isValid = inputmask.isValid("1'2\"", { mask: "9'9{1,2}\"", greedy: false, skipOptionalPartCharacter: "", "clearIncomplete": true });
     equal(isValid, true, "Result " + isValid);
     equal(isValid, true, "Result " + isValid);
 });
 });
 
 
 test("a13x3y isValid(\"some_body@mail.com\", {alias:\"email\"}", function () {
 test("a13x3y isValid(\"some_body@mail.com\", {alias:\"email\"}", function () {
-    var isValid = $.inputmask.isValid("some_body@mail.com", { alias: "email" });
+    var isValid = inputmask.isValid("some_body@mail.com", { alias: "email" });
     equal(isValid, true, "Result " + isValid);
     equal(isValid, true, "Result " + isValid);
-});
+});