ソースを参照

Merge pull request #1979 from isaac-mercieca/4.x

Element keeps the focus to itself in ie11
Robin Herbots 7 年 前
コミット
ec41c96c55
1 ファイル変更5 行追加3 行削除
  1. 5 3
      js/inputmask.js

+ 5 - 3
js/inputmask.js

@@ -2541,8 +2541,10 @@
 
                         input.inputmask.caretPos = {begin: begin, end: end}; //track caret internally
                         if ("selectionStart" in input) {
-                            input.selectionStart = begin;
-                            input.selectionEnd = end;
+                            if (input === document.activeElement) {
+                              input.selectionStart = begin;
+                              input.selectionEnd = end;
+                            }
                         } else if (window.getSelection) {
                             range = document.createRange();
                             if (input.firstChild === undefined || input.firstChild === null) {
@@ -3203,4 +3205,4 @@
         return Inputmask;
     }
 ))
-;
+;