File tree 1 file changed +7
-8
lines changed
packages/docusaurus/src/client/exports
1 file changed +7
-8
lines changed Original file line number Diff line number Diff line change 5
5
* LICENSE file in the root directory of this source tree.
6
6
*/
7
7
8
- const canUseDOM = ! ! (
8
+ const canUseDOM =
9
9
typeof window !== 'undefined' &&
10
- window . document &&
11
- window . document . createElement
12
- ) ;
10
+ 'document' in window &&
11
+ 'createElement' in window . document ;
13
12
14
13
const ExecutionEnvironment = {
15
14
canUseDOM,
16
15
16
+ // window.attachEvent is IE-specific; it's very likely Docusaurus won't work
17
+ // on IE anyway.
17
18
canUseEventListeners :
18
- // @ts -expect-error: window.attachEvent is IE specific.
19
- // See https://github.com/Microsoft/TypeScript/issues/3953#issuecomment-123396830
20
- canUseDOM && ! ! ( window . addEventListener || window . attachEvent ) ,
19
+ canUseDOM && ( 'addEventListener' in window || 'attachEvent' in window ) ,
21
20
22
21
canUseIntersectionObserver : canUseDOM && 'IntersectionObserver' in window ,
23
22
24
- canUseViewport : canUseDOM && ! ! window . screen ,
23
+ canUseViewport : canUseDOM && ' screen' in window ,
25
24
} ;
26
25
27
26
export default ExecutionEnvironment ;
You can’t perform that action at this time.
0 commit comments