Fix some iframe edge cases (#13650)

Should fix #13648 by fallback on `window` when `document.defaultView` does not exists anymore
This commit is contained in:
Jérôme Steunou
2018-09-14 16:44:14 +01:00
committed by Dan Abramov
parent d76bf0d21a
commit 2e515d67a0
+1 -1
View File
@@ -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);