Skip to content
This repository has been archived by the owner on Jan 24, 2019. It is now read-only.

Commit

Permalink
fix(mark): TypeError: input is undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
douglasduteil committed Dec 29, 2013
1 parent 223801e commit 5440d6f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions modules/mask/mask.js
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,7 @@ angular.module('ui.mask', [])
function isValidCaretPosition(pos){ return maskCaretMap.indexOf(pos) > -1; }

function getCaretPosition(input){
if (!input) return 0;
if (input.selectionStart !== undefined) {
return input.selectionStart;
} else if (document.selection) {
Expand All @@ -429,6 +430,7 @@ angular.module('ui.mask', [])
}

function setCaretPosition(input, pos){
if (!input) return 0;
if (input.offsetWidth === 0 || input.offsetHeight === 0) {
return; // Input's hidden
}
Expand All @@ -447,6 +449,7 @@ angular.module('ui.mask', [])
}

function getSelectionLength(input){
if (!input) return 0;
if (input.selectionStart !== undefined) {
return (input.selectionEnd - input.selectionStart);
}
Expand Down

0 comments on commit 5440d6f

Please sign in to comment.