Skip to content

Commit

Permalink
[fixed] typeof returns a string (canUseDOM).
Browse files Browse the repository at this point in the history
  • Loading branch information
diasbruno committed Oct 4, 2017
1 parent cd10612 commit 2b835d6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/components/Modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ import SafeHTMLElement from '../helpers/safeHTMLElement';
export const portalClassName = 'ReactModalPortal';
export const bodyOpenClassName = 'ReactModal__Body--open';

const canUseDOM = typeof window !== undefined;
const canUseDOM = typeof window !== 'undefined' || (
typeof document !== 'undefined' && document.createElement
);

const isReact16 = ReactDOM.createPortal !== undefined;
const createPortal = isReact16 ?
ReactDOM.createPortal :
Expand Down

0 comments on commit 2b835d6

Please sign in to comment.