Skip to content
This repository was archived by the owner on Sep 8, 2020. It is now read-only.

Commit bbbb1df

Browse files
AndyMcRorielukepfeiffer10
authored andcommitted
Prefer window.getSelection over document.selection (#162)
document.selection is non-standard, and window.getSelection is preferred. I ran into a bug where when using ui-mask inside of an iframe in IE11, our users were getting the error "Unpositioned markup pointer for this operation". Unfortunately, I was unable to change the other instance of window.getSelection as "moveStart" does not have an equivalent function. Another example of this error: https://social.msdn.microsoft.com/Forums/sqlserver/en-US/56bb70c7-eaef-4abb-b506-d2a2d4726e9e/ie10-error-unpositioned-markup-pointer-for-this-operation?forum=iewebdevelopment
1 parent e5d7ff0 commit bbbb1df

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/mask.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -707,6 +707,9 @@ angular.module('ui.mask', [])
707707
if (input.selectionStart !== undefined) {
708708
return (input.selectionEnd - input.selectionStart);
709709
}
710+
if (window.getSelection) {
711+
return (window.getSelection().toString().length);
712+
}
710713
if (document.selection) {
711714
return (document.selection.createRange().text.length);
712715
}

0 commit comments

Comments
 (0)