From ac7684b87bdbf7c1344fc02850bb765e76d17627 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Steunou?= Date: Fri, 14 Sep 2018 16:18:26 +0200 Subject: [PATCH] Fix some iframe edge cases Should fix #13648 by fallback on `window` when `document.defaultView` does not exists anymore --- packages/react-dom/src/client/ReactDOMSelection.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react-dom/src/client/ReactDOMSelection.js b/packages/react-dom/src/client/ReactDOMSelection.js index 00181336a6053..9f247af15b4f5 100644 --- a/packages/react-dom/src/client/ReactDOMSelection.js +++ b/packages/react-dom/src/client/ReactDOMSelection.js @@ -152,7 +152,7 @@ export function getModernOffsetsFromPoints( */ export function setOffsets(node, offsets) { const doc = node.ownerDocument || document; - const win = doc ? doc.defaultView : window; + const win = (doc && doc.defaultView) || window; const selection = win.getSelection(); const length = node.textContent.length; let start = Math.min(offsets.start, length);