Skip to content

Commit f77b53e

Browse files
committed
[chore] use canUseDOM from exenv.
it's already implemented in this package.
1 parent cc4577c commit f77b53e

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

Diff for: src/components/Modal.js

+3-5
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,13 @@ import ReactDOM from 'react-dom';
33
import PropTypes from 'prop-types';
44
import ModalPortal from './ModalPortal';
55
import * as ariaAppHider from '../helpers/ariaAppHider';
6-
import SafeHTMLElement from '../helpers/safeHTMLElement';
6+
import SafeHTMLElement, {
7+
canUseDOM
8+
} from '../helpers/safeHTMLElement';
79

810
export const portalClassName = 'ReactModalPortal';
911
export const bodyOpenClassName = 'ReactModal__Body--open';
1012

11-
const canUseDOM = typeof window !== 'undefined' &&
12-
typeof document !== 'undefined' &&
13-
typeof document.createElement === 'function';
14-
1513
const isReact16 = ReactDOM.createPortal !== undefined;
1614
const createPortal = isReact16 ?
1715
ReactDOM.createPortal :

Diff for: src/helpers/safeHTMLElement.js

+2
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,6 @@ const EE = ExecutionEnvironment;
44

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

7+
export const canUseDOM = EE.canUseDOM;
8+
79
export default SafeHTMLElement;

0 commit comments

Comments
 (0)