Răsfoiți Sursa

fix: work around IE/Edge bug when accessing document.activeElement from iframe

close #6157
Evan You 9 ani în urmă
părinte
comite
fc3d7cd7a9
1 a modificat fișierele cu 5 adăugiri și 1 ștergeri
  1. 5 1
      src/platforms/web/runtime/modules/dom-props.js

+ 5 - 1
src/platforms/web/runtime/modules/dom-props.js

@@ -63,7 +63,11 @@ function shouldUpdateValue (
 function isDirty (elm: acceptValueElm, checkVal: string): boolean {
   // return true when textbox (.number and .trim) loses focus and its value is
   // not equal to the updated value
-  return document.activeElement !== elm && elm.value !== checkVal
+  let notInFocus = true
+  // #6157
+  // work around IE bug when accessing document.activeElement in an iframe
+  try { notInFocus = document.activeElement !== elm } catch (e) {}
+  return notInFocus && elm.value !== checkVal
 }
 
 function isInputChanged (elm: any, newVal: string): boolean {