diff --git a/src/components/Modal.js b/src/components/Modal.js index 9d596304..027669b9 100644 --- a/src/components/Modal.js +++ b/src/components/Modal.js @@ -8,9 +8,9 @@ import SafeHTMLElement from '../helpers/safeHTMLElement'; export const portalClassName = 'ReactModalPortal'; export const bodyOpenClassName = 'ReactModal__Body--open'; -const canUseDOM = typeof window !== 'undefined' || ( - typeof document !== 'undefined' && document.createElement -); +const canUseDOM = typeof window !== 'undefined' && + typeof document !== 'undefined' && + typeof document.createElement === 'function'; const isReact16 = ReactDOM.createPortal !== undefined; const createPortal = isReact16 ?