Skip to content

Commit

Permalink
[Fix] #317: Applying ui-mask on multiple fields on a form sets focus …
Browse files Browse the repository at this point in the history
…on the last masked input box automatically
  • Loading branch information
asadighi committed Jun 15, 2015
1 parent 3f62d88 commit 4615f8e
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions modules/mask/mask.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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();
}
}
}

Expand Down

0 comments on commit 4615f8e

Please sign in to comment.