Skip to content

Commit

Permalink
[chore] use canUseDOM from exenv.
Browse files Browse the repository at this point in the history
it's already implemented in this package.
  • Loading branch information
diasbruno committed Oct 6, 2017
1 parent cc4577c commit f77b53e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/components/Modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,13 @@ import ReactDOM from 'react-dom';
import PropTypes from 'prop-types';
import ModalPortal from './ModalPortal';
import * as ariaAppHider from '../helpers/ariaAppHider';
import SafeHTMLElement from '../helpers/safeHTMLElement';
import SafeHTMLElement, {
canUseDOM
} from '../helpers/safeHTMLElement';

export const portalClassName = 'ReactModalPortal';
export const bodyOpenClassName = 'ReactModal__Body--open';

const canUseDOM = typeof window !== 'undefined' &&
typeof document !== 'undefined' &&
typeof document.createElement === 'function';

const isReact16 = ReactDOM.createPortal !== undefined;
const createPortal = isReact16 ?
ReactDOM.createPortal :
Expand Down
2 changes: 2 additions & 0 deletions src/helpers/safeHTMLElement.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ const EE = ExecutionEnvironment;

const SafeHTMLElement = EE.canUseDOM ? window.HTMLElement : {};

export const canUseDOM = EE.canUseDOM;

export default SafeHTMLElement;

0 comments on commit f77b53e

Please sign in to comment.