Skip to content

Commit

Permalink
fix(react-dom): access iframe contentWindow instead of contentDocument
Browse files Browse the repository at this point in the history
MDN has a list of methods for obtaining the window reference of an
iframe:

https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage#Syntax
  • Loading branch information
Renan Ferreira authored and renanvalentin committed Mar 13, 2019
1 parent 103378b commit 2aabdf5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/react-dom/src/client/ReactInputSelection.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ function getActiveElementDeep() {
let win = window;
let element = getActiveElement();
while (element instanceof win.HTMLIFrameElement) {
// Accessing the contentDocument of a HTMLIframeElement can cause the browser
// Accessing the contentWindow of a HTMLIframeElement can cause the browser
// to throw, e.g. if it has a cross-origin src attribute
try {
win = element.contentDocument.defaultView;
win = element.contentWindow;
} catch (e) {
return element;
}
Expand Down

0 comments on commit 2aabdf5

Please sign in to comment.