From 4615f8e2449d95badf280a9820b8e6429ebb99ab Mon Sep 17 00:00:00 2001 From: asadighi Date: Mon, 15 Jun 2015 14:58:21 -0700 Subject: [PATCH] [Fix] #317: Applying ui-mask on multiple fields on a form sets focus on the last masked input box automatically --- modules/mask/mask.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/modules/mask/mask.js b/modules/mask/mask.js index ccfa38f..5fe3c52 100644 --- a/modules/mask/mask.js +++ b/modules/mask/mask.js @@ -437,7 +437,7 @@ angular.module('ui.mask', []) if (input.selectionStart !== undefined) { return input.selectionStart; } else if (document.selection) { - if ($(input).is(':focus')) { + if (iElement.is(':focus')) { // Curse you IE input.focus(); var selection = document.selection.createRange(); @@ -454,20 +454,18 @@ angular.module('ui.mask', []) return; // Input's hidden } if (input.setSelectionRange) { - if ($(input).is(':focus')) { + if (iElement.is(':focus')) { input.focus(); input.setSelectionRange(pos, pos); } } else if (input.createTextRange) { - if ($(input).is(':focus')) { // Curse you IE var range = input.createTextRange(); range.collapse(true); range.moveEnd('character', pos); range.moveStart('character', pos); range.select(); - } } }