Browse Source

minor fixes + qunit fixes for FF & IE

Robin Herbots 12 years ago
parent
commit
bd37f36075

+ 1 - 1
bower.json

@@ -1,6 +1,6 @@
 {
 {
     "name": "jquery.inputmask",
     "name": "jquery.inputmask",
-    "version": "2.4.16",
+    "version": "2.4.17",
     "main": "./dist/jquery.inputmask.bundle.js",
     "main": "./dist/jquery.inputmask.bundle.js",
 	"description": "jquery.inputmask is a jquery plugin which create an input mask.
 	"description": "jquery.inputmask is a jquery plugin which create an input mask.
 
 

+ 1 - 1
build.properties

@@ -7,7 +7,7 @@ distdir = dist
 
 
 build.major = 2
 build.major = 2
 build.minor = 4
 build.minor = 4
-build.revision = 16
+build.revision = 17
 
 
 target = jquery.inputmask.bundle.js
 target = jquery.inputmask.bundle.js
 target.min = jquery.inputmask.bundle.min.js
 target.min = jquery.inputmask.bundle.min.js

BIN
dist/jQuery.InputMask.2.4.16.nupkg


BIN
dist/jQuery.InputMask.2.4.17.nupkg


+ 33 - 28
dist/jquery.inputmask.bundle.js

@@ -1,9 +1,9 @@
 /**
 /**
 * @license Input Mask plugin for jquery
 * @license Input Mask plugin for jquery
 * http://github.com/RobinHerbots/jquery.inputmask
 * http://github.com/RobinHerbots/jquery.inputmask
-* Copyright (c) 2010 - 2013 Robin Herbots
+* Copyright (c) 2010 - 2014 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: 2.4.16
+* Version: 2.4.17
 */
 */
 
 
 (function ($) {
 (function ($) {
@@ -232,7 +232,7 @@
             iphone = navigator.userAgent.match(new RegExp("iphone", "i")) !== null,
             iphone = navigator.userAgent.match(new RegExp("iphone", "i")) !== null,
             android = navigator.userAgent.match(new RegExp("android.*safari.*", "i")) !== null,
             android = navigator.userAgent.match(new RegExp("android.*safari.*", "i")) !== null,
             androidchrome = navigator.userAgent.match(new RegExp("android.*chrome.*", "i")) !== null,
             androidchrome = navigator.userAgent.match(new RegExp("android.*chrome.*", "i")) !== null,
-            pasteEvent = isInputEventSupported('paste') && !msie10 ? 'paste' : isInputEventSupported('input') ? 'input' : "propertychange";
+            pasteEvent = isInputEventSupported('paste') ? 'paste' : isInputEventSupported('input') ? 'input' : "propertychange";
 
 
 
 
         //masking scope
         //masking scope
@@ -814,7 +814,7 @@
                     setTimeout(function () {
                     setTimeout(function () {
                         var selectedCaret = caret(input), buffer = getActiveBuffer();
                         var selectedCaret = caret(input), buffer = getActiveBuffer();
                         if (selectedCaret.begin == selectedCaret.end) {
                         if (selectedCaret.begin == selectedCaret.end) {
-                            var clickPosition = opts.isRTL ? TranslatePosition(selectedCaret.begin) : selectedCaret.begin,
+                            var clickPosition = isRTL ? TranslatePosition(selectedCaret.begin) : selectedCaret.begin,
                                 lvp = getActiveMaskSet()["lastValidPosition"],
                                 lvp = getActiveMaskSet()["lastValidPosition"],
                                 lastPosition;
                                 lastPosition;
                             if (opts.isNumeric) {
                             if (opts.isNumeric) {
@@ -868,25 +868,15 @@
                 ).bind("keyup.inputmask", keyupEvent);
                 ).bind("keyup.inputmask", keyupEvent);
 
 
                 if (androidchrome) {
                 if (androidchrome) {
-                    $el.bind("input.inputmask", function (e) {
-                        if (skipInputEvent === true) {
-                            skipInputEvent = false;
-                            return true;
-                        }
-                        var input = this, $input = $(input);
-
-                        chromeValueOnInput = getActiveBuffer().join('');
-                        checkVal(input, false, false);
-                        writeBuffer(input, getActiveBuffer());
-                        if (isComplete(getActiveBuffer()) === true)
-                            $input.trigger("complete");
-                        $input.click();
-                    });
+                    $el.bind("input.inputmask", inputEvent);
                 } else {
                 } else {
                     $el.bind("keydown.inputmask", keydownEvent
                     $el.bind("keydown.inputmask", keydownEvent
                     ).bind("keypress.inputmask", keypressEvent);
                     ).bind("keypress.inputmask", keypressEvent);
                 }
                 }
 
 
+                if (msie10)
+                    $el.bind("input.inputmask", inputEvent);
+
                 //apply mask
                 //apply mask
                 checkVal(el, true, false);
                 checkVal(el, true, false);
                 valueOnFocus = getActiveBuffer().join('');
                 valueOnFocus = getActiveBuffer().join('');
@@ -1388,6 +1378,21 @@
                         }
                         }
                     }
                     }
                 }
                 }
+
+                function inputEvent(e) {
+                    if (skipInputEvent === true) {
+                        skipInputEvent = false;
+                        return true;
+                    }
+                    var input = this, $input = $(input);
+
+                    chromeValueOnInput = getActiveBuffer().join('');
+                    checkVal(input, false, false);
+                    writeBuffer(input, getActiveBuffer());
+                    if (isComplete(getActiveBuffer()) === true)
+                        $input.trigger("complete");
+                    $input.click();
+                }
             }
             }
 
 
             return {
             return {
@@ -1614,9 +1619,9 @@
 /*
 /*
 Input Mask plugin extensions
 Input Mask plugin extensions
 http://github.com/RobinHerbots/jquery.inputmask
 http://github.com/RobinHerbots/jquery.inputmask
-Copyright (c) 2010 - 2013 Robin Herbots
+Copyright (c) 2010 - 2014 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: 2.4.16
+Version: 2.4.17
 
 
 Optional extensions on the jquery.inputmask base
 Optional extensions on the jquery.inputmask base
 */
 */
@@ -1736,9 +1741,9 @@ Optional extensions on the jquery.inputmask base
 /*
 /*
 Input Mask plugin extensions
 Input Mask plugin extensions
 http://github.com/RobinHerbots/jquery.inputmask
 http://github.com/RobinHerbots/jquery.inputmask
-Copyright (c) 2010 - 2012 Robin Herbots
+Copyright (c) 2010 - 2014 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: 2.4.16
+Version: 2.4.17
 
 
 Optional extensions on the jquery.inputmask base
 Optional extensions on the jquery.inputmask base
 */
 */
@@ -2224,9 +2229,9 @@ Optional extensions on the jquery.inputmask base
 /*
 /*
 Input Mask plugin extensions
 Input Mask plugin extensions
 http://github.com/RobinHerbots/jquery.inputmask
 http://github.com/RobinHerbots/jquery.inputmask
-Copyright (c) 2010 - 2013 Robin Herbots
+Copyright (c) 2010 - 2014 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: 2.4.16
+Version: 2.4.17
 
 
 Optional extensions on the jquery.inputmask base
 Optional extensions on the jquery.inputmask base
 */
 */
@@ -2401,9 +2406,9 @@ Optional extensions on the jquery.inputmask base
 /*
 /*
 Input Mask plugin extensions
 Input Mask plugin extensions
 http://github.com/RobinHerbots/jquery.inputmask
 http://github.com/RobinHerbots/jquery.inputmask
-Copyright (c) 2010 - 2013 Robin Herbots
+Copyright (c) 2010 - 2014 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: 2.4.16
+Version: 2.4.17
 
 
 Regex extensions on the jquery.inputmask base
 Regex extensions on the jquery.inputmask base
 Allows for using regular expressions as a mask
 Allows for using regular expressions as a mask
@@ -2571,9 +2576,9 @@ Allows for using regular expressions as a mask
 /*
 /*
 Input Mask plugin extensions
 Input Mask plugin extensions
 http://github.com/RobinHerbots/jquery.inputmask
 http://github.com/RobinHerbots/jquery.inputmask
-Copyright (c) 2010 - 2013 Robin Herbots
+Copyright (c) 2010 - 2014 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: 2.4.16
+Version: 2.4.17
 
 
 Phone extension.
 Phone extension.
 When using this extension make sure you specify the correct url to get the masks
 When using this extension make sure you specify the correct url to get the masks

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


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


+ 1 - 1
jquery.inputmask.jquery.json

@@ -8,7 +8,7 @@
 		"inputmask",
 		"inputmask",
 		"mask"
 		"mask"
     ],
     ],
-    "version": "2.4.16",
+    "version": "2.4.17",
     "author": {
     "author": {
         "name": "Robin Herbots",
         "name": "Robin Herbots",
         "url": "http://github.com/RobinHerbots/jquery.inputmask"
         "url": "http://github.com/RobinHerbots/jquery.inputmask"

+ 21 - 16
js/jquery.inputmask.js

@@ -232,7 +232,7 @@
             iphone = navigator.userAgent.match(new RegExp("iphone", "i")) !== null,
             iphone = navigator.userAgent.match(new RegExp("iphone", "i")) !== null,
             android = navigator.userAgent.match(new RegExp("android.*safari.*", "i")) !== null,
             android = navigator.userAgent.match(new RegExp("android.*safari.*", "i")) !== null,
             androidchrome = navigator.userAgent.match(new RegExp("android.*chrome.*", "i")) !== null,
             androidchrome = navigator.userAgent.match(new RegExp("android.*chrome.*", "i")) !== null,
-            pasteEvent = isInputEventSupported('paste') && !msie10 ? 'paste' : isInputEventSupported('input') ? 'input' : "propertychange";
+            pasteEvent = isInputEventSupported('paste') ? 'paste' : isInputEventSupported('input') ? 'input' : "propertychange";
 
 
 
 
         //masking scope
         //masking scope
@@ -814,7 +814,7 @@
                     setTimeout(function () {
                     setTimeout(function () {
                         var selectedCaret = caret(input), buffer = getActiveBuffer();
                         var selectedCaret = caret(input), buffer = getActiveBuffer();
                         if (selectedCaret.begin == selectedCaret.end) {
                         if (selectedCaret.begin == selectedCaret.end) {
-                            var clickPosition = opts.isRTL ? TranslatePosition(selectedCaret.begin) : selectedCaret.begin,
+                            var clickPosition = isRTL ? TranslatePosition(selectedCaret.begin) : selectedCaret.begin,
                                 lvp = getActiveMaskSet()["lastValidPosition"],
                                 lvp = getActiveMaskSet()["lastValidPosition"],
                                 lastPosition;
                                 lastPosition;
                             if (opts.isNumeric) {
                             if (opts.isNumeric) {
@@ -868,25 +868,15 @@
                 ).bind("keyup.inputmask", keyupEvent);
                 ).bind("keyup.inputmask", keyupEvent);
 
 
                 if (androidchrome) {
                 if (androidchrome) {
-                    $el.bind("input.inputmask", function (e) {
-                        if (skipInputEvent === true) {
-                            skipInputEvent = false;
-                            return true;
-                        }
-                        var input = this, $input = $(input);
-
-                        chromeValueOnInput = getActiveBuffer().join('');
-                        checkVal(input, false, false);
-                        writeBuffer(input, getActiveBuffer());
-                        if (isComplete(getActiveBuffer()) === true)
-                            $input.trigger("complete");
-                        $input.click();
-                    });
+                    $el.bind("input.inputmask", inputEvent);
                 } else {
                 } else {
                     $el.bind("keydown.inputmask", keydownEvent
                     $el.bind("keydown.inputmask", keydownEvent
                     ).bind("keypress.inputmask", keypressEvent);
                     ).bind("keypress.inputmask", keypressEvent);
                 }
                 }
 
 
+                if (msie10)
+                    $el.bind("input.inputmask", inputEvent);
+
                 //apply mask
                 //apply mask
                 checkVal(el, true, false);
                 checkVal(el, true, false);
                 valueOnFocus = getActiveBuffer().join('');
                 valueOnFocus = getActiveBuffer().join('');
@@ -1388,6 +1378,21 @@
                         }
                         }
                     }
                     }
                 }
                 }
+
+                function inputEvent(e) {
+                    if (skipInputEvent === true) {
+                        skipInputEvent = false;
+                        return true;
+                    }
+                    var input = this, $input = $(input);
+
+                    chromeValueOnInput = getActiveBuffer().join('');
+                    checkVal(input, false, false);
+                    writeBuffer(input, getActiveBuffer());
+                    if (isComplete(getActiveBuffer()) === true)
+                        $input.trigger("complete");
+                    $input.click();
+                }
             }
             }
 
 
             return {
             return {

+ 52 - 35
qunit/tests.js

@@ -151,9 +151,10 @@ asyncTest("inputmask(\"9-AAA.999\") - change event", 1, function () {
     });
     });
 
 
     $("#testmask")[0].focus();
     $("#testmask")[0].focus();
-    $("#testmask").Type("1abc12");
-
-    $("#testmask").blur();
+    setTimeout(function () {
+        $("#testmask").Type("1abc12");
+        $("#testmask").blur();
+    }, 0);
 });
 });
 
 
 asyncTest("inputmask(\"9-AAA.999\", { onincomplete: ... })", 1, function () {
 asyncTest("inputmask(\"9-AAA.999\", { onincomplete: ... })", 1, function () {
@@ -454,7 +455,6 @@ test("inputmask(\"6703 9999 9999 9999 9\") ~ value=\"6703 1234 5678 9012 3\" - F
     $('body').append('<input type="text" id="testmask" value="6703 1234 5678 9012 3" />');
     $('body').append('<input type="text" id="testmask" value="6703 1234 5678 9012 3" />');
     $("#testmask").inputmask("6703 9999 9999 9999 9");
     $("#testmask").inputmask("6703 9999 9999 9999 9");
     equal($("#testmask").val(), "6703 1234 5678 9012 3", "Result " + $("#testmask").val());
     equal($("#testmask").val(), "6703 1234 5678 9012 3", "Result " + $("#testmask").val());
-
     $("#testmask").remove();
     $("#testmask").remove();
 });
 });
 
 
@@ -463,23 +463,25 @@ test("inputmask(\"6703 9999 9999 9999 9\") ~ type \"6703 1234 5678 9012 3\" + ba
     $("#testmask").inputmask("6703 9999 9999 9999 9");
     $("#testmask").inputmask("6703 9999 9999 9999 9");
     $("#testmask")[0].focus();
     $("#testmask")[0].focus();
     $("#testmask").Type("1234567890123");
     $("#testmask").Type("1234567890123");
-    $("#testmask").SendKey(keyCodes.BACKSPACE);	
+    $("#testmask").SendKey(keyCodes.BACKSPACE);
 
 
     equal($("#testmask").val(), "6703 1234 5678 9012 _", "Result " + $("#testmask").val());
     equal($("#testmask").val(), "6703 1234 5678 9012 _", "Result " + $("#testmask").val());
 
 
     $("#testmask").remove();
     $("#testmask").remove();
 });
 });
 
 
-test("inputmask(\"6703 9999 9999 9999 9\") ~ type \"6703670367036\" + backspace - FransVdb", function () {
+asyncTest("inputmask(\"6703 9999 9999 9999 9\") ~ type \"6703670367036\" + backspace - FransVdb", function () {
     $('body').append('<input type="text" id="testmask" />');
     $('body').append('<input type="text" id="testmask" />');
     $("#testmask").inputmask("6703 9999 9999 9999 9");
     $("#testmask").inputmask("6703 9999 9999 9999 9");
     $("#testmask")[0].focus();
     $("#testmask")[0].focus();
-    $("#testmask").Type("6703670367036");
-    $("#testmask").SendKey(keyCodes.BACKSPACE);	
-
-    equal($("#testmask").val(), "6703 6703 6703 6703 _", "Result " + $("#testmask").val());
-
-    $("#testmask").remove();
+    $("#testmask").click();
+    setTimeout(function () {
+        $("#testmask").Type("6703670367036");
+        $("#testmask").SendKey(keyCodes.BACKSPACE);
+        equal($("#testmask").val(), "6703 6703 6703 6703 _", "Result " + $("#testmask").val());
+        start();
+        $("#testmask").remove();
+    }, 0);
 });
 });
 
 
 
 
@@ -488,11 +490,11 @@ asyncTest("inputmask(\"+7 (999) 999-99-99\") ~ paste \"+7 (+79114041112___) ___-
     $('body').append('<input type="text" id="testmask" />');
     $('body').append('<input type="text" id="testmask" />');
     $("#testmask").inputmask("+7 (999) 999-99-99");
     $("#testmask").inputmask("+7 (999) 999-99-99");
     $("#testmask").paste("+7 (+79114041112___) ___-__-__");
     $("#testmask").paste("+7 (+79114041112___) ___-__-__");
-    
+
     setTimeout(function () {
     setTimeout(function () {
-	equal($("#testmask").val(), "+7 (911) 404-11-12", "Result " + $("#testmask").val());
-	start();
-	$("#testmask").remove();
+        equal($("#testmask").val(), "+7 (911) 404-11-12", "Result " + $("#testmask").val());
+        start();
+        $("#testmask").remove();
     }, 0);
     }, 0);
 
 
 });
 });
@@ -500,18 +502,18 @@ asyncTest("inputmask(\"+7 (999) 999-99-99\") ~ paste \"+7 (+79114041112___) ___-
 asyncTest("inputmask(\"+7 (999) 999-99-99\") ~ paste \"0079114041112\" - monoblaine", function () {
 asyncTest("inputmask(\"+7 (999) 999-99-99\") ~ paste \"0079114041112\" - monoblaine", function () {
     $('body').append('<input type="text" id="testmask" />');
     $('body').append('<input type="text" id="testmask" />');
     $("#testmask").inputmask("+7 (999) 999-99-99", {
     $("#testmask").inputmask("+7 (999) 999-99-99", {
-		onBeforePaste : function(pastedValue) {
-			//just simplistic for the test ;-)
-			var strippedValue = pastedValue.substr(2);
-			return strippedValue;
-		}
-	});
+        onBeforePaste: function (pastedValue) {
+            //just simplistic for the test ;-)
+            var strippedValue = pastedValue.substr(2);
+            return strippedValue;
+        }
+    });
     $("#testmask").paste("0079114041112");
     $("#testmask").paste("0079114041112");
-    
+
     setTimeout(function () {
     setTimeout(function () {
-	equal($("#testmask").val(), "+7 (911) 404-11-12", "Result " + $("#testmask").val());
-	start();
-	$("#testmask").remove();
+        equal($("#testmask").val(), "+7 (911) 404-11-12", "Result " + $("#testmask").val());
+        start();
+        $("#testmask").remove();
     }, 0);
     }, 0);
 
 
 });
 });
@@ -962,7 +964,7 @@ test("inputmask(\"mm/dd/yyyy\") - select some input 1 - Guamaso", function () {
     $("#testmask").inputmask("mm/dd/yyyy");
     $("#testmask").inputmask("mm/dd/yyyy");
 
 
     $("#testmask")[0].focus();
     $("#testmask")[0].focus();
-	caret($("#testmask")[0], 0, 5);
+    caret($("#testmask")[0], 0, 5);
     $("#testmask").Type("1");
     $("#testmask").Type("1");
     equal($("#testmask").val(), "1m/dd/yyyy", "Result " + $("#testmask").val());
     equal($("#testmask").val(), "1m/dd/yyyy", "Result " + $("#testmask").val());
     $("#testmask").remove();
     $("#testmask").remove();
@@ -974,14 +976,26 @@ test("inputmask(\"dd/mm/yyyy\") - input 2331973 - remove 23", function () {
 
 
     $("#testmask")[0].focus();
     $("#testmask")[0].focus();
     $("#testmask").Type("23031973");
     $("#testmask").Type("23031973");
-	caret($("#testmask"), 0,2);
-	$("#testmask").SendKey(keyCodes.DELETE);
-   
+    caret($("#testmask"), 0, 2);
+    $("#testmask").SendKey(keyCodes.DELETE);
+
     equal($("#testmask").val(), "dd/03/1973", "Result " + $("#testmask").val());
     equal($("#testmask").val(), "dd/03/1973", "Result " + $("#testmask").val());
 
 
     $("#testmask").remove();
     $("#testmask").remove();
 });
 });
 
 
+test("inputmask(\"dd/mm/yyyy\") - input 01011000 - Skiv22", function () {
+    $('body').append('<input type="text" id="testmask" />');
+    $("#testmask").inputmask("dd/mm/yyyy", { yearrange: { minyear: 1000, maxyear: 2099 } });
+
+    $("#testmask")[0].focus();
+    $("#testmask").Type("01011000");
+
+    equal($("#testmask").val(), "01/01/1000", "Result " + $("#testmask").val());
+
+    $("#testmask").remove();
+});
+
 module("Numeric.Extensions");
 module("Numeric.Extensions");
 test("inputmask(\"decimal\", { autoGroup: true, groupSeparator: \",\" }\") - input 12345.123", function () {
 test("inputmask(\"decimal\", { autoGroup: true, groupSeparator: \",\" }\") - input 12345.123", function () {
     $('body').append('<input type="text" id="testmask" />');
     $('body').append('<input type="text" id="testmask" />');
@@ -1208,8 +1222,8 @@ test("inputmask(\"decimal\") - value=\"123.45\" Replace last integer", function
 
 
     $("#testmask")[0].focus();
     $("#testmask")[0].focus();
     $("#testmask").Type("123.45");
     $("#testmask").Type("123.45");
-	caret( $("#testmask"), 2,3);
-	$("#testmask").SendKey("7");
+    caret($("#testmask"), 2, 3);
+    $("#testmask").SendKey("7");
 
 
     equal($("#testmask").val(), "127.45", "Result " + $("#testmask").val());
     equal($("#testmask").val(), "127.45", "Result " + $("#testmask").val());
     $("#testmask").remove();
     $("#testmask").remove();
@@ -1228,7 +1242,7 @@ test("inputmask - Multiple inputs masked, Integer mask doesn't allow typing - #4
 
 
     $("#testmask")[0].focus();
     $("#testmask")[0].focus();
     $("#testmask").Type("12345");
     $("#testmask").Type("12345");
-	
+
     equal($("#testmask").val(), "12,345", "Result " + $("#testmask").val());
     equal($("#testmask").val(), "12,345", "Result " + $("#testmask").val());
     $("#testmask").remove();
     $("#testmask").remove();
     $("#testmask2").remove();
     $("#testmask2").remove();
@@ -1403,6 +1417,7 @@ asyncTest("inputmask({ mask: \"€ 999.999.999,99\", { numericInput: true, radix
     $('body').append('<input type="text" id="testmask" />');
     $('body').append('<input type="text" id="testmask" />');
     $("#testmask").inputmask('€ 999.999.999,99', { numericInput: true, radixPoint: "," });
     $("#testmask").inputmask('€ 999.999.999,99', { numericInput: true, radixPoint: "," });
 
 
+    $("#testmask")[0].focus();
     $("#testmask").click();
     $("#testmask").click();
     setTimeout(function () {
     setTimeout(function () {
         $("#testmask").Type("123");
         $("#testmask").Type("123");
@@ -1417,6 +1432,7 @@ asyncTest("inputmask({ mask: \"€ 999.999.999,99\", { numericInput: true, radix
     $('body').append('<input type="text" id="testmask" />');
     $('body').append('<input type="text" id="testmask" />');
     $("#testmask").inputmask('€ 999.999.999,99', { numericInput: true, radixPoint: "," });
     $("#testmask").inputmask('€ 999.999.999,99', { numericInput: true, radixPoint: "," });
 
 
+    $("#testmask")[0].focus();
     $("#testmask").click();
     $("#testmask").click();
     setTimeout(function () {
     setTimeout(function () {
         $("#testmask").Type("123,45");
         $("#testmask").Type("123,45");
@@ -1726,12 +1742,13 @@ asyncTest("inputmask(\"phone\") - Brazil switch", 1, function () {
     $("#testmask").inputmask("phone", { "url": "http://rawgithub.com/RobinHerbots/jquery.inputmask/2.x/js/phone-codes/phone-codes.json" });
     $("#testmask").inputmask("phone", { "url": "http://rawgithub.com/RobinHerbots/jquery.inputmask/2.x/js/phone-codes/phone-codes.json" });
 
 
     setTimeout(function () {
     setTimeout(function () {
-        
+        $("#testmask")[0].focus();
+        caret($("#testmask"), $("#testmask")[0].value.length); //for FF
+        $("#testmask").SendKey(keyCodes.BACKSPACE);
         $("#testmask").SendKey(keyCodes.BACKSPACE);
         $("#testmask").SendKey(keyCodes.BACKSPACE);
         $("#testmask").SendKey(keyCodes.BACKSPACE);
         $("#testmask").SendKey(keyCodes.BACKSPACE);
         $("#testmask").SendKey(keyCodes.BACKSPACE);
         $("#testmask").SendKey(keyCodes.BACKSPACE);
         $("#testmask").SendKey(keyCodes.BACKSPACE);
         $("#testmask").SendKey(keyCodes.BACKSPACE);
-		$("#testmask").SendKey(keyCodes.BACKSPACE);
         $("#testmask").Type("451234");
         $("#testmask").Type("451234");
         equal($("#testmask").val(), "+55-12-12345-1234", "Result " + $("#testmask").val());
         equal($("#testmask").val(), "+55-12-12345-1234", "Result " + $("#testmask").val());
         start();
         start();