Browse Source

enhande inputfallback

Robin Herbots 10 years ago
parent
commit
c22edc7327

+ 3 - 1
CHANGELOG.md

@@ -1,7 +1,7 @@
 # Change Log
 All notable changes to this project will be documented in this file.
 
-## [UNRELEASED]
+## [3.2.6] - 2016-01-25
 ### Added
 - add jitMasking option
 - supportsInputType option
@@ -9,12 +9,14 @@ All notable changes to this project will be documented in this file.
 - include textarea as a valid masking element
 
 ### Updates
+- enhance inputfallback ~ merge mobileinputevent
 - caching with cache-dependency check in the getTests fn
 - implement missing parts in the jqlite DependencyLib
 - Remove namespaces for events (simplifies implementing other dependencyLibs, besides jquery)
 - update alternation logic
 
 ### Fixed
+- Windows Phone User unable to set Date #993
 - '405 not allowed' error on loading phone-codes.js on certain Ajax configuration. #1156
 - Issue with reset of inputmask field #1157
 - IE11 clear not working in emulated IE9 mode #1144

+ 0 - 510
dist/inputmask/inputmask.date.extensions.js

@@ -1,510 +0,0 @@
-/*!
-* inputmask.date.extensions.js
-* http://github.com/RobinHerbots/jquery.inputmask
-* Copyright (c) 2010 - 2016 Robin Herbots
-* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.2.6-33
-*/
-!function(factory) {
-    "function" == typeof define && define.amd ? define([ "inputmask.dependencyLib", "inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("./inputmask.dependencyLib.jquery"), require("./inputmask")) : factory(window.dependencyLib || jQuery, window.Inputmask);
-}(function($, Inputmask) {
-    return Inputmask.extendDefinitions({
-        h: {
-            validator: "[01][0-9]|2[0-3]",
-            cardinality: 2,
-            prevalidator: [ {
-                validator: "[0-2]",
-                cardinality: 1
-            } ]
-        },
-        s: {
-            validator: "[0-5][0-9]",
-            cardinality: 2,
-            prevalidator: [ {
-                validator: "[0-5]",
-                cardinality: 1
-            } ]
-        },
-        d: {
-            validator: "0[1-9]|[12][0-9]|3[01]",
-            cardinality: 2,
-            prevalidator: [ {
-                validator: "[0-3]",
-                cardinality: 1
-            } ]
-        },
-        m: {
-            validator: "0[1-9]|1[012]",
-            cardinality: 2,
-            prevalidator: [ {
-                validator: "[01]",
-                cardinality: 1
-            } ]
-        },
-        y: {
-            validator: "(19|20)\\d{2}",
-            cardinality: 4,
-            prevalidator: [ {
-                validator: "[12]",
-                cardinality: 1
-            }, {
-                validator: "(19|20)",
-                cardinality: 2
-            }, {
-                validator: "(19|20)\\d",
-                cardinality: 3
-            } ]
-        }
-    }), Inputmask.extendAliases({
-        "dd/mm/yyyy": {
-            mask: "1/2/y",
-            placeholder: "dd/mm/yyyy",
-            regex: {
-                val1pre: new RegExp("[0-3]"),
-                val1: new RegExp("0[1-9]|[12][0-9]|3[01]"),
-                val2pre: function(separator) {
-                    var escapedSeparator = Inputmask.escapeRegex.call(this, separator);
-                    return new RegExp("((0[1-9]|[12][0-9]|3[01])" + escapedSeparator + "[01])");
-                },
-                val2: function(separator) {
-                    var escapedSeparator = Inputmask.escapeRegex.call(this, separator);
-                    return new RegExp("((0[1-9]|[12][0-9])" + escapedSeparator + "(0[1-9]|1[012]))|(30" + escapedSeparator + "(0[13-9]|1[012]))|(31" + escapedSeparator + "(0[13578]|1[02]))");
-                }
-            },
-            leapday: "29/02/",
-            separator: "/",
-            yearrange: {
-                minyear: 1900,
-                maxyear: 2099
-            },
-            isInYearRange: function(chrs, minyear, maxyear) {
-                if (isNaN(chrs)) return !1;
-                var enteredyear = parseInt(chrs.concat(minyear.toString().slice(chrs.length))), enteredyear2 = parseInt(chrs.concat(maxyear.toString().slice(chrs.length)));
-                return (isNaN(enteredyear) ? !1 : enteredyear >= minyear && maxyear >= enteredyear) || (isNaN(enteredyear2) ? !1 : enteredyear2 >= minyear && maxyear >= enteredyear2);
-            },
-            determinebaseyear: function(minyear, maxyear, hint) {
-                var currentyear = new Date().getFullYear();
-                if (minyear > currentyear) return minyear;
-                if (currentyear > maxyear) {
-                    for (var maxYearPrefix = maxyear.toString().slice(0, 2), maxYearPostfix = maxyear.toString().slice(2, 4); maxYearPrefix + hint > maxyear; ) maxYearPrefix--;
-                    var maxxYear = maxYearPrefix + maxYearPostfix;
-                    return minyear > maxxYear ? minyear : maxxYear;
-                }
-                return currentyear;
-            },
-            onKeyDown: function(e, buffer, caretPos, opts) {
-                var $input = $(this);
-                if (e.ctrlKey && e.keyCode === Inputmask.keyCode.RIGHT) {
-                    var today = new Date();
-                    $input.val(today.getDate().toString() + (today.getMonth() + 1).toString() + today.getFullYear().toString()), 
-                    $input.trigger("setvalue");
-                }
-            },
-            getFrontValue: function(mask, buffer, opts) {
-                for (var start = 0, length = 0, i = 0; i < mask.length && "2" !== mask.charAt(i); i++) {
-                    var definition = opts.definitions[mask.charAt(i)];
-                    definition ? (start += length, length = definition.cardinality) : length++;
-                }
-                return buffer.join("").substr(start, length);
-            },
-            definitions: {
-                "1": {
-                    validator: function(chrs, maskset, pos, strict, opts) {
-                        var isValid = opts.regex.val1.test(chrs);
-                        return strict || isValid || chrs.charAt(1) !== opts.separator && -1 === "-./".indexOf(chrs.charAt(1)) || !(isValid = opts.regex.val1.test("0" + chrs.charAt(0))) ? isValid : (maskset.buffer[pos - 1] = "0", 
-                        {
-                            refreshFromBuffer: {
-                                start: pos - 1,
-                                end: pos
-                            },
-                            pos: pos,
-                            c: chrs.charAt(0)
-                        });
-                    },
-                    cardinality: 2,
-                    prevalidator: [ {
-                        validator: function(chrs, maskset, pos, strict, opts) {
-                            var pchrs = chrs;
-                            isNaN(maskset.buffer[pos + 1]) || (pchrs += maskset.buffer[pos + 1]);
-                            var isValid = 1 === pchrs.length ? opts.regex.val1pre.test(pchrs) : opts.regex.val1.test(pchrs);
-                            if (!strict && !isValid) {
-                                if (isValid = opts.regex.val1.test(chrs + "0")) return maskset.buffer[pos] = chrs, 
-                                maskset.buffer[++pos] = "0", {
-                                    pos: pos,
-                                    c: "0"
-                                };
-                                if (isValid = opts.regex.val1.test("0" + chrs)) return maskset.buffer[pos] = "0", 
-                                pos++, {
-                                    pos: pos
-                                };
-                            }
-                            return isValid;
-                        },
-                        cardinality: 1
-                    } ]
-                },
-                "2": {
-                    validator: function(chrs, maskset, pos, strict, opts) {
-                        var frontValue = opts.getFrontValue(maskset.mask, maskset.buffer, opts);
-                        -1 !== frontValue.indexOf(opts.placeholder[0]) && (frontValue = "01" + opts.separator);
-                        var isValid = opts.regex.val2(opts.separator).test(frontValue + chrs);
-                        if (!strict && !isValid && (chrs.charAt(1) === opts.separator || -1 !== "-./".indexOf(chrs.charAt(1))) && (isValid = opts.regex.val2(opts.separator).test(frontValue + "0" + chrs.charAt(0)))) return maskset.buffer[pos - 1] = "0", 
-                        {
-                            refreshFromBuffer: {
-                                start: pos - 1,
-                                end: pos
-                            },
-                            pos: pos,
-                            c: chrs.charAt(0)
-                        };
-                        if (opts.mask.indexOf("2") === opts.mask.length - 1 && isValid) {
-                            var dayMonthValue = maskset.buffer.join("").substr(4, 4) + chrs;
-                            if (dayMonthValue !== opts.leapday) return !0;
-                            var year = parseInt(maskset.buffer.join("").substr(0, 4), 10);
-                            return year % 4 === 0 ? year % 100 === 0 ? year % 400 === 0 ? !0 : !1 : !0 : !1;
-                        }
-                        return isValid;
-                    },
-                    cardinality: 2,
-                    prevalidator: [ {
-                        validator: function(chrs, maskset, pos, strict, opts) {
-                            isNaN(maskset.buffer[pos + 1]) || (chrs += maskset.buffer[pos + 1]);
-                            var frontValue = opts.getFrontValue(maskset.mask, maskset.buffer, opts);
-                            -1 !== frontValue.indexOf(opts.placeholder[0]) && (frontValue = "01" + opts.separator);
-                            var isValid = 1 === chrs.length ? opts.regex.val2pre(opts.separator).test(frontValue + chrs) : opts.regex.val2(opts.separator).test(frontValue + chrs);
-                            return strict || isValid || !(isValid = opts.regex.val2(opts.separator).test(frontValue + "0" + chrs)) ? isValid : (maskset.buffer[pos] = "0", 
-                            pos++, {
-                                pos: pos
-                            });
-                        },
-                        cardinality: 1
-                    } ]
-                },
-                y: {
-                    validator: function(chrs, maskset, pos, strict, opts) {
-                        if (opts.isInYearRange(chrs, opts.yearrange.minyear, opts.yearrange.maxyear)) {
-                            var dayMonthValue = maskset.buffer.join("").substr(0, 6);
-                            if (dayMonthValue !== opts.leapday) return !0;
-                            var year = parseInt(chrs, 10);
-                            return year % 4 === 0 ? year % 100 === 0 ? year % 400 === 0 ? !0 : !1 : !0 : !1;
-                        }
-                        return !1;
-                    },
-                    cardinality: 4,
-                    prevalidator: [ {
-                        validator: function(chrs, maskset, pos, strict, opts) {
-                            var isValid = opts.isInYearRange(chrs, opts.yearrange.minyear, opts.yearrange.maxyear);
-                            if (!strict && !isValid) {
-                                var yearPrefix = opts.determinebaseyear(opts.yearrange.minyear, opts.yearrange.maxyear, chrs + "0").toString().slice(0, 1);
-                                if (isValid = opts.isInYearRange(yearPrefix + chrs, opts.yearrange.minyear, opts.yearrange.maxyear)) return maskset.buffer[pos++] = yearPrefix.charAt(0), 
-                                {
-                                    pos: pos
-                                };
-                                if (yearPrefix = opts.determinebaseyear(opts.yearrange.minyear, opts.yearrange.maxyear, chrs + "0").toString().slice(0, 2), 
-                                isValid = opts.isInYearRange(yearPrefix + chrs, opts.yearrange.minyear, opts.yearrange.maxyear)) return maskset.buffer[pos++] = yearPrefix.charAt(0), 
-                                maskset.buffer[pos++] = yearPrefix.charAt(1), {
-                                    pos: pos
-                                };
-                            }
-                            return isValid;
-                        },
-                        cardinality: 1
-                    }, {
-                        validator: function(chrs, maskset, pos, strict, opts) {
-                            var isValid = opts.isInYearRange(chrs, opts.yearrange.minyear, opts.yearrange.maxyear);
-                            if (!strict && !isValid) {
-                                var yearPrefix = opts.determinebaseyear(opts.yearrange.minyear, opts.yearrange.maxyear, chrs).toString().slice(0, 2);
-                                if (isValid = opts.isInYearRange(chrs[0] + yearPrefix[1] + chrs[1], opts.yearrange.minyear, opts.yearrange.maxyear)) return maskset.buffer[pos++] = yearPrefix.charAt(1), 
-                                {
-                                    pos: pos
-                                };
-                                if (yearPrefix = opts.determinebaseyear(opts.yearrange.minyear, opts.yearrange.maxyear, chrs).toString().slice(0, 2), 
-                                opts.isInYearRange(yearPrefix + chrs, opts.yearrange.minyear, opts.yearrange.maxyear)) {
-                                    var dayMonthValue = maskset.buffer.join("").substr(0, 6);
-                                    if (dayMonthValue !== opts.leapday) isValid = !0; else {
-                                        var year = parseInt(chrs, 10);
-                                        isValid = year % 4 === 0 ? year % 100 === 0 ? year % 400 === 0 ? !0 : !1 : !0 : !1;
-                                    }
-                                } else isValid = !1;
-                                if (isValid) return maskset.buffer[pos - 1] = yearPrefix.charAt(0), maskset.buffer[pos++] = yearPrefix.charAt(1), 
-                                maskset.buffer[pos++] = chrs.charAt(0), {
-                                    refreshFromBuffer: {
-                                        start: pos - 3,
-                                        end: pos
-                                    },
-                                    pos: pos
-                                };
-                            }
-                            return isValid;
-                        },
-                        cardinality: 2
-                    }, {
-                        validator: function(chrs, maskset, pos, strict, opts) {
-                            return opts.isInYearRange(chrs, opts.yearrange.minyear, opts.yearrange.maxyear);
-                        },
-                        cardinality: 3
-                    } ]
-                }
-            },
-            insertMode: !1,
-            autoUnmask: !1
-        },
-        "mm/dd/yyyy": {
-            placeholder: "mm/dd/yyyy",
-            alias: "dd/mm/yyyy",
-            regex: {
-                val2pre: function(separator) {
-                    var escapedSeparator = Inputmask.escapeRegex.call(this, separator);
-                    return new RegExp("((0[13-9]|1[012])" + escapedSeparator + "[0-3])|(02" + escapedSeparator + "[0-2])");
-                },
-                val2: function(separator) {
-                    var escapedSeparator = Inputmask.escapeRegex.call(this, separator);
-                    return new RegExp("((0[1-9]|1[012])" + escapedSeparator + "(0[1-9]|[12][0-9]))|((0[13-9]|1[012])" + escapedSeparator + "30)|((0[13578]|1[02])" + escapedSeparator + "31)");
-                },
-                val1pre: new RegExp("[01]"),
-                val1: new RegExp("0[1-9]|1[012]")
-            },
-            leapday: "02/29/",
-            onKeyDown: function(e, buffer, caretPos, opts) {
-                var $input = $(this);
-                if (e.ctrlKey && e.keyCode === Inputmask.keyCode.RIGHT) {
-                    var today = new Date();
-                    $input.val((today.getMonth() + 1).toString() + today.getDate().toString() + today.getFullYear().toString()), 
-                    $input.trigger("setvalue");
-                }
-            }
-        },
-        "yyyy/mm/dd": {
-            mask: "y/1/2",
-            placeholder: "yyyy/mm/dd",
-            alias: "mm/dd/yyyy",
-            leapday: "/02/29",
-            onKeyDown: function(e, buffer, caretPos, opts) {
-                var $input = $(this);
-                if (e.ctrlKey && e.keyCode === Inputmask.keyCode.RIGHT) {
-                    var today = new Date();
-                    $input.val(today.getFullYear().toString() + (today.getMonth() + 1).toString() + today.getDate().toString()), 
-                    $input.trigger("setvalue");
-                }
-            }
-        },
-        "dd.mm.yyyy": {
-            mask: "1.2.y",
-            placeholder: "dd.mm.yyyy",
-            leapday: "29.02.",
-            separator: ".",
-            alias: "dd/mm/yyyy"
-        },
-        "dd-mm-yyyy": {
-            mask: "1-2-y",
-            placeholder: "dd-mm-yyyy",
-            leapday: "29-02-",
-            separator: "-",
-            alias: "dd/mm/yyyy"
-        },
-        "mm.dd.yyyy": {
-            mask: "1.2.y",
-            placeholder: "mm.dd.yyyy",
-            leapday: "02.29.",
-            separator: ".",
-            alias: "mm/dd/yyyy"
-        },
-        "mm-dd-yyyy": {
-            mask: "1-2-y",
-            placeholder: "mm-dd-yyyy",
-            leapday: "02-29-",
-            separator: "-",
-            alias: "mm/dd/yyyy"
-        },
-        "yyyy.mm.dd": {
-            mask: "y.1.2",
-            placeholder: "yyyy.mm.dd",
-            leapday: ".02.29",
-            separator: ".",
-            alias: "yyyy/mm/dd"
-        },
-        "yyyy-mm-dd": {
-            mask: "y-1-2",
-            placeholder: "yyyy-mm-dd",
-            leapday: "-02-29",
-            separator: "-",
-            alias: "yyyy/mm/dd"
-        },
-        datetime: {
-            mask: "1/2/y h:s",
-            placeholder: "dd/mm/yyyy hh:mm",
-            alias: "dd/mm/yyyy",
-            regex: {
-                hrspre: new RegExp("[012]"),
-                hrs24: new RegExp("2[0-4]|1[3-9]"),
-                hrs: new RegExp("[01][0-9]|2[0-4]"),
-                ampm: new RegExp("^[a|p|A|P][m|M]"),
-                mspre: new RegExp("[0-5]"),
-                ms: new RegExp("[0-5][0-9]")
-            },
-            timeseparator: ":",
-            hourFormat: "24",
-            definitions: {
-                h: {
-                    validator: function(chrs, maskset, pos, strict, opts) {
-                        if ("24" === opts.hourFormat && 24 === parseInt(chrs, 10)) return maskset.buffer[pos - 1] = "0", 
-                        maskset.buffer[pos] = "0", {
-                            refreshFromBuffer: {
-                                start: pos - 1,
-                                end: pos
-                            },
-                            c: "0"
-                        };
-                        var isValid = opts.regex.hrs.test(chrs);
-                        if (!strict && !isValid && (chrs.charAt(1) === opts.timeseparator || -1 !== "-.:".indexOf(chrs.charAt(1))) && (isValid = opts.regex.hrs.test("0" + chrs.charAt(0)))) return maskset.buffer[pos - 1] = "0", 
-                        maskset.buffer[pos] = chrs.charAt(0), pos++, {
-                            refreshFromBuffer: {
-                                start: pos - 2,
-                                end: pos
-                            },
-                            pos: pos,
-                            c: opts.timeseparator
-                        };
-                        if (isValid && "24" !== opts.hourFormat && opts.regex.hrs24.test(chrs)) {
-                            var tmp = parseInt(chrs, 10);
-                            return 24 === tmp ? (maskset.buffer[pos + 5] = "a", maskset.buffer[pos + 6] = "m") : (maskset.buffer[pos + 5] = "p", 
-                            maskset.buffer[pos + 6] = "m"), tmp -= 12, 10 > tmp ? (maskset.buffer[pos] = tmp.toString(), 
-                            maskset.buffer[pos - 1] = "0") : (maskset.buffer[pos] = tmp.toString().charAt(1), 
-                            maskset.buffer[pos - 1] = tmp.toString().charAt(0)), {
-                                refreshFromBuffer: {
-                                    start: pos - 1,
-                                    end: pos + 6
-                                },
-                                c: maskset.buffer[pos]
-                            };
-                        }
-                        return isValid;
-                    },
-                    cardinality: 2,
-                    prevalidator: [ {
-                        validator: function(chrs, maskset, pos, strict, opts) {
-                            var isValid = opts.regex.hrspre.test(chrs);
-                            return strict || isValid || !(isValid = opts.regex.hrs.test("0" + chrs)) ? isValid : (maskset.buffer[pos] = "0", 
-                            pos++, {
-                                pos: pos
-                            });
-                        },
-                        cardinality: 1
-                    } ]
-                },
-                s: {
-                    validator: "[0-5][0-9]",
-                    cardinality: 2,
-                    prevalidator: [ {
-                        validator: function(chrs, maskset, pos, strict, opts) {
-                            var isValid = opts.regex.mspre.test(chrs);
-                            return strict || isValid || !(isValid = opts.regex.ms.test("0" + chrs)) ? isValid : (maskset.buffer[pos] = "0", 
-                            pos++, {
-                                pos: pos
-                            });
-                        },
-                        cardinality: 1
-                    } ]
-                },
-                t: {
-                    validator: function(chrs, maskset, pos, strict, opts) {
-                        return opts.regex.ampm.test(chrs + "m");
-                    },
-                    casing: "lower",
-                    cardinality: 1
-                }
-            },
-            insertMode: !1,
-            autoUnmask: !1
-        },
-        datetime12: {
-            mask: "1/2/y h:s t\\m",
-            placeholder: "dd/mm/yyyy hh:mm xm",
-            alias: "datetime",
-            hourFormat: "12"
-        },
-        "mm/dd/yyyy hh:mm xm": {
-            mask: "1/2/y h:s t\\m",
-            placeholder: "mm/dd/yyyy hh:mm xm",
-            alias: "datetime12",
-            regex: {
-                val2pre: function(separator) {
-                    var escapedSeparator = Inputmask.escapeRegex.call(this, separator);
-                    return new RegExp("((0[13-9]|1[012])" + escapedSeparator + "[0-3])|(02" + escapedSeparator + "[0-2])");
-                },
-                val2: function(separator) {
-                    var escapedSeparator = Inputmask.escapeRegex.call(this, separator);
-                    return new RegExp("((0[1-9]|1[012])" + escapedSeparator + "(0[1-9]|[12][0-9]))|((0[13-9]|1[012])" + escapedSeparator + "30)|((0[13578]|1[02])" + escapedSeparator + "31)");
-                },
-                val1pre: new RegExp("[01]"),
-                val1: new RegExp("0[1-9]|1[012]")
-            },
-            leapday: "02/29/",
-            onKeyDown: function(e, buffer, caretPos, opts) {
-                var $input = $(this);
-                if (e.ctrlKey && e.keyCode === Inputmask.keyCode.RIGHT) {
-                    var today = new Date();
-                    $input.val((today.getMonth() + 1).toString() + today.getDate().toString() + today.getFullYear().toString()), 
-                    $input.trigger("setvalue");
-                }
-            }
-        },
-        "hh:mm t": {
-            mask: "h:s t\\m",
-            placeholder: "hh:mm xm",
-            alias: "datetime",
-            hourFormat: "12"
-        },
-        "h:s t": {
-            mask: "h:s t\\m",
-            placeholder: "hh:mm xm",
-            alias: "datetime",
-            hourFormat: "12"
-        },
-        "hh:mm:ss": {
-            mask: "h:s:s",
-            placeholder: "hh:mm:ss",
-            alias: "datetime",
-            autoUnmask: !1
-        },
-        "hh:mm": {
-            mask: "h:s",
-            placeholder: "hh:mm",
-            alias: "datetime",
-            autoUnmask: !1
-        },
-        date: {
-            alias: "dd/mm/yyyy"
-        },
-        "mm/yyyy": {
-            mask: "1/y",
-            placeholder: "mm/yyyy",
-            leapday: "donotuse",
-            separator: "/",
-            alias: "mm/dd/yyyy"
-        },
-        shamsi: {
-            regex: {
-                val2pre: function(separator) {
-                    var escapedSeparator = Inputmask.escapeRegex.call(this, separator);
-                    return new RegExp("((0[1-9]|1[012])" + escapedSeparator + "[0-3])");
-                },
-                val2: function(separator) {
-                    var escapedSeparator = Inputmask.escapeRegex.call(this, separator);
-                    return new RegExp("((0[1-9]|1[012])" + escapedSeparator + "(0[1-9]|[12][0-9]))|((0[1-9]|1[012])" + escapedSeparator + "30)|((0[1-6])" + escapedSeparator + "31)");
-                },
-                val1pre: new RegExp("[01]"),
-                val1: new RegExp("0[1-9]|1[012]")
-            },
-            yearrange: {
-                minyear: 1300,
-                maxyear: 1499
-            },
-            mask: "y/1/2",
-            leapday: "/12/30",
-            placeholder: "yyyy/mm/dd",
-            alias: "mm/dd/yyyy",
-            clearIncomplete: !0
-        }
-    }), Inputmask;
-});

+ 0 - 12
dist/inputmask/inputmask.dependencyLib.jquery.js

@@ -1,12 +0,0 @@
-/*!
-* inputmask.dependencyLib.jquery.js
-* http://github.com/RobinHerbots/jquery.inputmask
-* Copyright (c) 2010 - 2016 Robin Herbots
-* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.2.6-33
-*/
-!function(factory) {
-    "function" == typeof define && define.amd ? define([ "jquery" ], factory) : "object" == typeof exports ? module.exports = factory(require("jquery")) : factory(jQuery);
-}(function($) {
-    return window.dependencyLib = $, $;
-});

+ 0 - 76
dist/inputmask/inputmask.extensions.js

@@ -1,76 +0,0 @@
-/*!
-* inputmask.extensions.js
-* http://github.com/RobinHerbots/jquery.inputmask
-* Copyright (c) 2010 - 2016 Robin Herbots
-* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.2.6-33
-*/
-!function(factory) {
-    "function" == typeof define && define.amd ? define([ "inputmask.dependencyLib", "inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("./inputmask.dependencyLib.jquery"), require("./inputmask")) : factory(window.dependencyLib || jQuery, window.Inputmask);
-}(function($, Inputmask) {
-    return Inputmask.extendDefinitions({
-        A: {
-            validator: "[A-Za-z\u0410-\u044f\u0401\u0451\xc0-\xff\xb5]",
-            cardinality: 1,
-            casing: "upper"
-        },
-        "&": {
-            validator: "[0-9A-Za-z\u0410-\u044f\u0401\u0451\xc0-\xff\xb5]",
-            cardinality: 1,
-            casing: "upper"
-        },
-        "#": {
-            validator: "[0-9A-Fa-f]",
-            cardinality: 1,
-            casing: "upper"
-        }
-    }), Inputmask.extendAliases({
-        url: {
-            definitions: {
-                i: {
-                    validator: ".",
-                    cardinality: 1
-                }
-            },
-            mask: "(\\http://)|(\\http\\s://)|(ftp://)|(ftp\\s://)i{+}",
-            insertMode: !1,
-            autoUnmask: !1
-        },
-        ip: {
-            mask: "i[i[i]].i[i[i]].i[i[i]].i[i[i]]",
-            definitions: {
-                i: {
-                    validator: function(chrs, maskset, pos, strict, opts) {
-                        return pos - 1 > -1 && "." !== maskset.buffer[pos - 1] ? (chrs = maskset.buffer[pos - 1] + chrs, 
-                        chrs = pos - 2 > -1 && "." !== maskset.buffer[pos - 2] ? maskset.buffer[pos - 2] + chrs : "0" + chrs) : chrs = "00" + chrs, 
-                        new RegExp("25[0-5]|2[0-4][0-9]|[01][0-9][0-9]").test(chrs);
-                    },
-                    cardinality: 1
-                }
-            },
-            onUnMask: function(maskedValue, unmaskedValue, opts) {
-                return maskedValue;
-            }
-        },
-        email: {
-            mask: "*{1,64}[.*{1,64}][.*{1,64}][.*{1,64}]@*{1,64}[.*{2,64}][.*{2,6}][.*{1,2}]",
-            greedy: !1,
-            onBeforePaste: function(pastedValue, opts) {
-                return pastedValue = pastedValue.toLowerCase(), pastedValue.replace("mailto:", "");
-            },
-            definitions: {
-                "*": {
-                    validator: "[0-9A-Za-z!#$%&'*+/=?^_`{|}~-]",
-                    cardinality: 1,
-                    casing: "lower"
-                }
-            },
-            onUnMask: function(maskedValue, unmaskedValue, opts) {
-                return maskedValue;
-            }
-        },
-        mac: {
-            mask: "##:##:##:##:##:##"
-        }
-    }), Inputmask;
-});

File diff suppressed because it is too large
+ 0 - 1461
dist/inputmask/inputmask.js


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


+ 0 - 49
dist/inputmask/inputmask.phone.extensions.js

@@ -1,49 +0,0 @@
-/*!
-* inputmask.phone.extensions.js
-* http://github.com/RobinHerbots/jquery.inputmask
-* Copyright (c) 2010 - 2016 Robin Herbots
-* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.2.6-33
-*/
-!function(factory) {
-    "function" == typeof define && define.amd ? define([ "jquery", "inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("jquery"), require("./inputmask")) : factory(window.dependencyLib || jQuery, window.Inputmask);
-}(function($, Inputmask) {
-    return Inputmask.extendAliases({
-        phone: {
-            url: "phone-codes/phone-codes.js",
-            countrycode: "",
-            mask: function(opts) {
-                opts.definitions["#"] = opts.definitions[9];
-                var maskList = [];
-                return $.ajax({
-                    url: opts.url,
-                    async: !1,
-                    type: "get",
-                    dataType: "json",
-                    success: function(response) {
-                        maskList = response;
-                    },
-                    error: function(xhr, ajaxOptions, thrownError) {
-                        alert(thrownError + " - " + opts.url);
-                    }
-                }), maskList = maskList.sort(function(a, b) {
-                    return (a.mask || a) < (b.mask || b) ? -1 : 1;
-                });
-            },
-            keepStatic: !1,
-            nojumps: !0,
-            nojumpsThreshold: 1,
-            onBeforeMask: function(value, opts) {
-                var processedValue = value.replace(/^0/g, "");
-                return (processedValue.indexOf(opts.countrycode) > 1 || -1 === processedValue.indexOf(opts.countrycode)) && (processedValue = "+" + opts.countrycode + processedValue), 
-                processedValue;
-            }
-        },
-        phonebe: {
-            alias: "phone",
-            url: "phone-codes/phone-be.js",
-            countrycode: "32",
-            nojumpsThreshold: 4
-        }
-    }), Inputmask;
-});

+ 0 - 115
dist/inputmask/inputmask.regex.extensions.js

@@ -1,115 +0,0 @@
-/*!
-* inputmask.regex.extensions.js
-* http://github.com/RobinHerbots/jquery.inputmask
-* Copyright (c) 2010 - 2016 Robin Herbots
-* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.2.6-33
-*/
-!function(factory) {
-    "function" == typeof define && define.amd ? define([ "inputmask.dependencyLib", "inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("./inputmask.dependencyLib.jquery"), require("./inputmask")) : factory(window.dependencyLib || jQuery, window.Inputmask);
-}(function($, Inputmask) {
-    return Inputmask.extendAliases({
-        Regex: {
-            mask: "r",
-            greedy: !1,
-            repeat: "*",
-            regex: null,
-            regexTokens: null,
-            tokenizer: /\[\^?]?(?:[^\\\]]+|\\[\S\s]?)*]?|\\(?:0(?:[0-3][0-7]{0,2}|[4-7][0-7]?)?|[1-9][0-9]*|x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}|c[A-Za-z]|[\S\s]?)|\((?:\?[:=!]?)?|(?:[?*+]|\{[0-9]+(?:,[0-9]*)?\})\??|[^.?*+^${[()|\\]+|./g,
-            quantifierFilter: /[0-9]+[^,]/,
-            isComplete: function(buffer, opts) {
-                return new RegExp(opts.regex).test(buffer.join(""));
-            },
-            definitions: {
-                r: {
-                    validator: function(chrs, maskset, pos, strict, opts) {
-                        function RegexToken(isGroup, isQuantifier) {
-                            this.matches = [], this.isGroup = isGroup || !1, this.isQuantifier = isQuantifier || !1, 
-                            this.quantifier = {
-                                min: 1,
-                                max: 1
-                            }, this.repeaterPart = void 0;
-                        }
-                        function analyseRegex() {
-                            var match, m, currentToken = new RegexToken(), opengroups = [];
-                            for (opts.regexTokens = []; match = opts.tokenizer.exec(opts.regex); ) switch (m = match[0], 
-                            m.charAt(0)) {
-                              case "(":
-                                opengroups.push(new RegexToken(!0));
-                                break;
-
-                              case ")":
-                                groupToken = opengroups.pop(), opengroups.length > 0 ? opengroups[opengroups.length - 1].matches.push(groupToken) : currentToken.matches.push(groupToken);
-                                break;
-
-                              case "{":
-                              case "+":
-                              case "*":
-                                var quantifierToken = new RegexToken(!1, !0);
-                                m = m.replace(/[{}]/g, "");
-                                var mq = m.split(","), mq0 = isNaN(mq[0]) ? mq[0] : parseInt(mq[0]), mq1 = 1 === mq.length ? mq0 : isNaN(mq[1]) ? mq[1] : parseInt(mq[1]);
-                                if (quantifierToken.quantifier = {
-                                    min: mq0,
-                                    max: mq1
-                                }, opengroups.length > 0) {
-                                    var matches = opengroups[opengroups.length - 1].matches;
-                                    match = matches.pop(), match.isGroup || (groupToken = new RegexToken(!0), groupToken.matches.push(match), 
-                                    match = groupToken), matches.push(match), matches.push(quantifierToken);
-                                } else match = currentToken.matches.pop(), match.isGroup || (groupToken = new RegexToken(!0), 
-                                groupToken.matches.push(match), match = groupToken), currentToken.matches.push(match), 
-                                currentToken.matches.push(quantifierToken);
-                                break;
-
-                              default:
-                                opengroups.length > 0 ? opengroups[opengroups.length - 1].matches.push(m) : currentToken.matches.push(m);
-                            }
-                            currentToken.matches.length > 0 && opts.regexTokens.push(currentToken);
-                        }
-                        function validateRegexToken(token, fromGroup) {
-                            var isvalid = !1;
-                            fromGroup && (regexPart += "(", openGroupCount++);
-                            for (var mndx = 0; mndx < token.matches.length; mndx++) {
-                                var matchToken = token.matches[mndx];
-                                if (matchToken.isGroup === !0) isvalid = validateRegexToken(matchToken, !0); else if (matchToken.isQuantifier === !0) {
-                                    var crrntndx = $.inArray(matchToken, token.matches), matchGroup = token.matches[crrntndx - 1], regexPartBak = regexPart;
-                                    if (isNaN(matchToken.quantifier.max)) {
-                                        for (;matchToken.repeaterPart && matchToken.repeaterPart !== regexPart && matchToken.repeaterPart.length > regexPart.length && !(isvalid = validateRegexToken(matchGroup, !0)); ) ;
-                                        isvalid = isvalid || validateRegexToken(matchGroup, !0), isvalid && (matchToken.repeaterPart = regexPart), 
-                                        regexPart = regexPartBak + matchToken.quantifier.max;
-                                    } else {
-                                        for (var i = 0, qm = matchToken.quantifier.max - 1; qm > i && !(isvalid = validateRegexToken(matchGroup, !0)); i++) ;
-                                        regexPart = regexPartBak + "{" + matchToken.quantifier.min + "," + matchToken.quantifier.max + "}";
-                                    }
-                                } else if (void 0 !== matchToken.matches) for (var k = 0; k < matchToken.length && !(isvalid = validateRegexToken(matchToken[k], fromGroup)); k++) ; else {
-                                    var testExp;
-                                    if ("[" == matchToken.charAt(0)) {
-                                        testExp = regexPart, testExp += matchToken;
-                                        for (var j = 0; openGroupCount > j; j++) testExp += ")";
-                                        var exp = new RegExp("^(" + testExp + ")$");
-                                        isvalid = exp.test(bufferStr);
-                                    } else for (var l = 0, tl = matchToken.length; tl > l; l++) if ("\\" !== matchToken.charAt(l)) {
-                                        testExp = regexPart, testExp += matchToken.substr(0, l + 1), testExp = testExp.replace(/\|$/, "");
-                                        for (var j = 0; openGroupCount > j; j++) testExp += ")";
-                                        var exp = new RegExp("^(" + testExp + ")$");
-                                        if (isvalid = exp.test(bufferStr)) break;
-                                    }
-                                    regexPart += matchToken;
-                                }
-                                if (isvalid) break;
-                            }
-                            return fromGroup && (regexPart += ")", openGroupCount--), isvalid;
-                        }
-                        var bufferStr, groupToken, cbuffer = maskset.buffer.slice(), regexPart = "", isValid = !1, openGroupCount = 0;
-                        null === opts.regexTokens && analyseRegex(), cbuffer.splice(pos, 0, chrs), bufferStr = cbuffer.join("");
-                        for (var i = 0; i < opts.regexTokens.length; i++) {
-                            var regexToken = opts.regexTokens[i];
-                            if (isValid = validateRegexToken(regexToken, regexToken.isGroup)) break;
-                        }
-                        return isValid;
-                    },
-                    cardinality: 1
-                }
-            }
-        }
-    }), Inputmask;
-});

+ 0 - 60
dist/inputmask/jquery.inputmask.js

@@ -1,60 +0,0 @@
-/*!
-* jquery.inputmask.js
-* http://github.com/RobinHerbots/jquery.inputmask
-* Copyright (c) 2010 - 2016 Robin Herbots
-* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.2.6-33
-*/
-!function(factory) {
-    "function" == typeof define && define.amd ? define([ "jquery", "inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("jquery"), require("./inputmask")) : factory(jQuery, window.Inputmask);
-}(function($, Inputmask) {
-    return void 0 === $.fn.inputmask && ($.fn.inputmask = function(fn, options) {
-        var nptmask, input = this[0];
-        if (options = options || {}, "string" == typeof fn) switch (fn) {
-          case "unmaskedvalue":
-            return input && input.inputmask ? input.inputmask.unmaskedvalue() : $(input).val();
-
-          case "remove":
-            return this.each(function() {
-                this.inputmask && this.inputmask.remove();
-            });
-
-          case "getemptymask":
-            return input && input.inputmask ? input.inputmask.getemptymask() : "";
-
-          case "hasMaskedValue":
-            return input && input.inputmask ? input.inputmask.hasMaskedValue() : !1;
-
-          case "isComplete":
-            return input && input.inputmask ? input.inputmask.isComplete() : !0;
-
-          case "getmetadata":
-            return input && input.inputmask ? input.inputmask.getmetadata() : void 0;
-
-          case "setvalue":
-            $(input).val(options), input && void 0 !== input.inputmask && $(input).triggerHandler("setvalue");
-            break;
-
-          case "option":
-            if ("string" != typeof options) return this.each(function() {
-                return void 0 !== this.inputmask ? this.inputmask.option(options) : void 0;
-            });
-            if (input && void 0 !== input.inputmask) return input.inputmask.option(options);
-            break;
-
-          default:
-            return options.alias = fn, nptmask = new Inputmask(options), this.each(function() {
-                nptmask.mask(this);
-            });
-        } else {
-            if ("object" == typeof fn) return nptmask = new Inputmask(fn), void 0 === fn.mask && void 0 === fn.alias ? this.each(function() {
-                return void 0 !== this.inputmask ? this.inputmask.option(fn) : void nptmask.mask(this);
-            }) : this.each(function() {
-                nptmask.mask(this);
-            });
-            if (void 0 === fn) return this.each(function() {
-                nptmask = new Inputmask(options), nptmask.mask(this);
-            });
-        }
-    }), $.fn.inputmask;
-});

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


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


+ 0 - 8
dist/min/inputmask/inputmask.dependencyLib.jquery.min.js

@@ -1,8 +0,0 @@
-/*!
-* inputmask.dependencyLib.jquery.min.js
-* http://github.com/RobinHerbots/jquery.inputmask
-* Copyright (c) 2010 - 2016 Robin Herbots
-* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.2.6-33
-*/
-!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof exports?module.exports=a(require("jquery")):a(jQuery)}(function(a){return window.dependencyLib=a,a});

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


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


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


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


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


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


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


+ 53 - 79
js/inputmask.js

@@ -304,7 +304,7 @@
 
 		function isElementTypeSupported(input, opts) {
 			var elementType = input.getAttribute("type");
-			var isSupported = (input.tagName === "INPUT" && opts.supportsInputType.indexOf(elementType) !== -1) || input.isContentEditable || input.tagName === "TEXTAREA";
+			var isSupported = (input.tagName === "INPUT" && $.inArray(elementType, opts.supportsInputType) !== -1) || input.isContentEditable || input.tagName === "TEXTAREA";
 			if (!isSupported) {
 				var el = document.createElement("input");
 				el.setAttribute("type", elementType);
@@ -732,15 +732,7 @@
 			iphone = /iphone/i.test(ua) && !iemobile,
 			android = /android.*safari.*/i.test(ua) && !iemobile,
 			androidchrome = /android.*chrome.*/i.test(ua),
-			androidfirefox = /android.*firefox.*/i.test(ua),
-			kindle = /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),
-			PasteEventType = isInputEventSupported("paste") ? "paste" : isInputEventSupported("input") ? "input" : "propertychange";
-
-		//if (androidchrome) {
-		//		var browser = navigator.userAgent.match(new RegExp("chrome.*", "i")),
-		//				version = parseInt(new RegExp(/[0-9]+/).exec(browser));
-		//		androidchrome32 = (version == 32);
-		//}
+			androidfirefox = /android.*firefox.*/i.test(ua);
 
 		//masking scope
 		//actionObj definition see below
@@ -1045,7 +1037,7 @@
 										ndxInitializer = resolveNdxInitializer(testPos, amndx);
 										match = handleMatch(alternateToken.matches[amndx] || maskToken.matches[amndx], [amndx].concat(loopNdx), quantifierRecurse) || match;
 										if (match !== true && match !== undefined && (altIndexArr[altIndexArr.length - 1] < alternateToken.matches.length)) { //no match in the alternations (length mismatch) => look further
-											var ntndx = maskToken.matches.indexOf(match) + 1;
+											var ntndx = $.inArray(match, maskToken.matches) + 1;
 											if (maskToken.matches.length > ntndx) {
 												match = handleMatch(maskToken.matches[ntndx], [ntndx].concat(loopNdx.slice(1, loopNdx.length)), quantifierRecurse);
 												if (match) {
@@ -1725,21 +1717,21 @@
 
 
 				$.each(inputValue, function(ndx, charCode) {
-					var keypress = new $.Event("keypress");
-					if (charCode !== undefined) {
+					if (charCode !== undefined) { //inputfallback strips some elements out of the inputarray.  $.each logically presents them as undefined
+						var keypress = new $.Event("keypress");
 						keypress.which = charCode.charCodeAt(0);
-					}
-					charCodes += charCode;
-					var lvp = getLastValidPosition(undefined, true),
-						lvTest = getMaskSet().validPositions[lvp],
-						nextTest = getTestTemplate(lvp + 1, lvTest ? lvTest.locator.slice() : undefined, lvp);
-					if (!isTemplateMatch() || strict || opts.autoUnmask) {
-						var pos = strict ? ndx : (nextTest.match.fn == null && nextTest.match.optionality && (lvp + 1) < getMaskSet().p ? lvp + 1 : getMaskSet().p);
-						keypressEvent.call(input, keypress, true, false, strict, pos);
-						initialNdx = pos + 1;
-						charCodes = "";
-					} else {
-						keypressEvent.call(input, keypress, true, false, true, lvp + 1);
+						charCodes += charCode;
+						var lvp = getLastValidPosition(undefined, true),
+							lvTest = getMaskSet().validPositions[lvp],
+							nextTest = getTestTemplate(lvp + 1, lvTest ? lvTest.locator.slice() : undefined, lvp);
+						if (!isTemplateMatch() || strict || opts.autoUnmask) {
+							var pos = strict ? ndx : (nextTest.match.fn == null && nextTest.match.optionality && (lvp + 1) < getMaskSet().p ? lvp + 1 : getMaskSet().p);
+							keypressEvent.call(input, keypress, true, false, strict, pos);
+							initialNdx = pos + 1;
+							charCodes = "";
+						} else {
+							keypressEvent.call(input, keypress, true, false, true, lvp + 1);
+						}
 					}
 				});
 				if (writeOut) {
@@ -1959,7 +1951,7 @@
 					input.inputmask.events[eventName] = input.inputmask.events[eventName] || [];
 					input.inputmask.events[eventName].push(ev);
 
-					if (["submit", "reset"].indexOf(eventName) != -1) {
+					if ($.inArray(eventName, ["submit", "reset"]) !== -1) {
 						if (input.form != null) $(input.form).on(eventName, ev);
 					} else {
 						$(input).on(eventName, ev);
@@ -1972,7 +1964,7 @@
 						$.each(events, function(eventName, evArr) {
 							while (evArr.length > 0) {
 								var ev = evArr.pop();
-								if (["submit", "reset"].indexOf(eventName) !== -1) {
+								if ($.inArray(eventName, ["submit", "reset"]) !== -1) {
 									if (input.form != null) $(input.form).off(eventName, ev);
 								} else {
 									$(input).off(eventName, ev);
@@ -2344,21 +2336,17 @@
 					$input = $(input),
 					inputValue = input.inputmask._valueGet(true),
 					caretPos = caret(input);
-				//paste event for IE8 and lower I guess ;-)
-				if (e.type === "propertychange" && input.inputmask._valueGet().length <= getMaskLength()) {
-					return true;
-				} else if (e.type === "paste") {
-					var valueBeforeCaret = inputValue.substr(0, caretPos.begin),
-						valueAfterCaret = inputValue.substr(caretPos.end, inputValue.length);
 
-					if (valueBeforeCaret === getBufferTemplate().slice(0, caretPos.begin).join("")) valueBeforeCaret = "";
-					if (valueAfterCaret === getBufferTemplate().slice(caretPos.end).join("")) valueAfterCaret = "";
+				var valueBeforeCaret = inputValue.substr(0, caretPos.begin),
+					valueAfterCaret = inputValue.substr(caretPos.end, inputValue.length);
 
-					if (window.clipboardData && window.clipboardData.getData) { // IE
-						inputValue = valueBeforeCaret + window.clipboardData.getData("Text") + valueAfterCaret;
-					} else if (ev.clipboardData && ev.clipboardData.getData) {
-						inputValue = valueBeforeCaret + ev.clipboardData.getData("text/plain") + valueAfterCaret;
-					}
+				if (valueBeforeCaret === getBufferTemplate().slice(0, caretPos.begin).join("")) valueBeforeCaret = "";
+				if (valueAfterCaret === getBufferTemplate().slice(caretPos.end).join("")) valueAfterCaret = "";
+
+				if (window.clipboardData && window.clipboardData.getData) { // IE
+					inputValue = valueBeforeCaret + window.clipboardData.getData("Text") + valueAfterCaret;
+				} else if (ev.clipboardData && ev.clipboardData.getData) {
+					inputValue = valueBeforeCaret + ev.clipboardData.getData("text/plain") + valueAfterCaret;
 				}
 
 				var pasteValue = inputValue;
@@ -2385,45 +2373,37 @@
 			function inputFallBackEvent(e) { //fallback when keypress & compositionevents fail
 				var input = this,
 					inputValue = input.inputmask._valueGet();
+
 				if (getBuffer().join("") !== inputValue) {
-					inputValue = inputValue.split("");
-					for (var i = inputValue.length; i > 0; i--) {
-						if (inputValue[i] === getPlaceholder(i)) {
-							delete inputValue[i];
+					var caretPos = caret(input);
+					inputValue = inputValue.replace(new RegExp("(" + Inputmask.escapeRegex(getBufferTemplate().join("")) + ")*"), "");
+					if (caretPos.begin > inputValue.length) {
+						caret(input, inputValue.length);
+						caretPos = caret(input);
+					}
+					//detect & treat possible backspace
+					if ((getBuffer().length - inputValue.length) === 1 && inputValue.charAt(caretPos.begin) !== getBuffer()[caretPos.begin] && inputValue.charAt(caretPos.begin + 1) !== getBuffer()[caretPos.begin] && !isMask(caretPos.begin)) {
+						e.keyCode = Inputmask.keyCode.BACKSPACE;
+						keydownEvent.call(input, e);
+					} else {
+						var lvp = getLastValidPosition() + 1;
+						var bufferTemplate = getBuffer().slice(lvp).join('');
+						while (inputValue.match(Inputmask.escapeRegex(bufferTemplate) + "$") === null) {
+							bufferTemplate = bufferTemplate.slice(1);
 						}
-					}
+						inputValue = inputValue.replace(bufferTemplate, "");
+						inputValue = inputValue.split("");
 
-					checkVal(input, true, false, inputValue);
+						checkVal(input, true, false, inputValue);
 
-					if (isComplete(getBuffer()) === true) {
-						$(input).trigger("complete");
+						if (isComplete(getBuffer()) === true) {
+							$(input).trigger("complete");
+						}
 					}
 					e.preventDefault();
 				}
 			}
 
-			function mobileInputEvent(e) {
-				var input = this;
-
-				//backspace in chrome32 only fires input event - detect & treat
-				var caretPos = caret(input),
-					currentValue = input.inputmask._valueGet();
-
-				currentValue = currentValue.replace(new RegExp("(" + Inputmask.escapeRegex(getBufferTemplate().join("")) + ")*"), "");
-				//correct caretposition for chrome
-				if (caretPos.begin > currentValue.length) {
-					caret(input, currentValue.length);
-					caretPos = caret(input);
-				}
-				if ((getBuffer().length - currentValue.length) === 1 && currentValue.charAt(caretPos.begin) !== getBuffer()[caretPos.begin] && currentValue.charAt(caretPos.begin + 1) !== getBuffer()[caretPos.begin] && !isMask(caretPos.begin)) {
-					e.keyCode = opts.keyCode.BACKSPACE;
-					keydownEvent.call(input, e);
-				} else {
-					inputFallBackEvent.call(this, e);
-				}
-				e.preventDefault();
-			}
-
 			function compositionStartEvent(e) {
 				var ev = e.originalEvent || e;
 				undoValue = getBuffer().join("");
@@ -2682,7 +2662,7 @@
 					EventRuler.on(el, "mouseleave", mouseleaveEvent);
 					EventRuler.on(el, "click", clickEvent);
 					EventRuler.on(el, "dblclick", dblclickEvent);
-					EventRuler.on(el, PasteEventType, pasteEvent);
+					EventRuler.on(el, "paste", pasteEvent);
 					EventRuler.on(el, "dragdrop", pasteEvent);
 					EventRuler.on(el, "drop", pasteEvent);
 					EventRuler.on(el, "cut", cutEvent);
@@ -2691,7 +2671,7 @@
 					EventRuler.on(el, "cleared", opts.oncleared);
 					EventRuler.on(el, "keydown", keydownEvent);
 					EventRuler.on(el, "keypress", keypressEvent);
-
+					EventRuler.on(el, "input", inputFallBackEvent);
 
 					if (!androidfirefox) {
 						EventRuler.on(el, "compositionstart", compositionStartEvent);
@@ -2699,13 +2679,7 @@
 						EventRuler.on(el, "compositionend", compositionEndEvent);
 					}
 
-					if (PasteEventType === "paste") {
-						EventRuler.on(el, "input", inputFallBackEvent);
-					}
-					if (android || androidfirefox || androidchrome || kindle) {
-						EventRuler.off(el, "input");
-						EventRuler.on(el, "input", mobileInputEvent);
-					}
+
 				}
 				EventRuler.on(el, "setvalue", setValueEvent);
 

+ 21 - 20
js/inputmask.phone.extensions.js

@@ -31,33 +31,34 @@ When using this extension make sure you specify the correct url to get the masks
 			"phone": {
 				url: "phone-codes/phone-codes.js",
 				countrycode: "",
+				phoneCodeCache: {},
 				mask: function(opts) {
-					opts.definitions["#"] = opts.definitions["9"];
-					var maskList = [];
-					$.ajax({
-						url: opts.url,
-						async: false,
-						type: "get",
-						dataType: "json",
-						success: function(response) {
-							maskList = response;
-						},
-						error: function(xhr, ajaxOptions, thrownError) {
-							alert(thrownError + " - " + opts.url);
-						}
-					});
+					if (opts.phoneCodeCache[opts.url] === undefined) {
+						opts.definitions["#"] = opts.definitions["9"];
+						$.ajax({
+							url: opts.url,
+							async: false,
+							type: "get",
+							dataType: "json",
+							success: function(response) {
+								maskList = response;
+							},
+							error: function(xhr, ajaxOptions, thrownError) {
+								alert(thrownError + " - " + opts.url);
+							}
+						});
 
-					maskList = maskList.sort(function(a, b) {
-						return (a.mask || a) < (b.mask || b) ? -1 : 1;
-					});
-
-					return maskList;
+						opts.phoneCodeCache[opts.url] = maskList.sort(function(a, b) {
+							return (a.mask || a) < (b.mask || b) ? -1 : 1;
+						});
+					}
+					return opts.phoneCodeCache[opts.url];
 				},
 				keepStatic: false,
 				nojumps: true,
 				nojumpsThreshold: 1,
 				onBeforeMask: function(value, opts) {
-					var processedValue = value.replace(/^0/g, "");
+					var processedValue = value.replace(/^0{1,2}/, "").replace(/[\s]/g, "");
 					if (processedValue.indexOf(opts.countrycode) > 1 || processedValue.indexOf(opts.countrycode) === -1) {
 						processedValue = "+" + opts.countrycode + processedValue;
 					}