Skip to content

Commit 4615f8e

Browse files
committed
[Fix] angular-ui#317: Applying ui-mask on multiple fields on a form sets focus on the last masked input box automatically
1 parent 3f62d88 commit 4615f8e

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

modules/mask/mask.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ angular.module('ui.mask', [])
437437
if (input.selectionStart !== undefined) {
438438
return input.selectionStart;
439439
} else if (document.selection) {
440-
if ($(input).is(':focus')) {
440+
if (iElement.is(':focus')) {
441441
// Curse you IE
442442
input.focus();
443443
var selection = document.selection.createRange();
@@ -454,20 +454,18 @@ angular.module('ui.mask', [])
454454
return; // Input's hidden
455455
}
456456
if (input.setSelectionRange) {
457-
if ($(input).is(':focus')) {
457+
if (iElement.is(':focus')) {
458458
input.focus();
459459
input.setSelectionRange(pos, pos);
460460
}
461461
}
462462
else if (input.createTextRange) {
463-
if ($(input).is(':focus')) {
464463
// Curse you IE
465464
var range = input.createTextRange();
466465
range.collapse(true);
467466
range.moveEnd('character', pos);
468467
range.moveStart('character', pos);
469468
range.select();
470-
}
471469
}
472470
}
473471

0 commit comments

Comments
 (0)