File tree Expand file tree Collapse file tree 1 file changed +7
-8
lines changed
packages/docusaurus/src/client/exports Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Original file line number Diff line number Diff line change 55 * LICENSE file in the root directory of this source tree.
66 */
77
8- const canUseDOM = ! ! (
8+ const canUseDOM =
99 typeof window !== 'undefined' &&
10- window . document &&
11- window . document . createElement
12- ) ;
10+ 'document' in window &&
11+ 'createElement' in window . document ;
1312
1413const ExecutionEnvironment = {
1514 canUseDOM,
1615
16+ // window.attachEvent is IE-specific; it's very likely Docusaurus won't work
17+ // on IE anyway.
1718 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 ) ,
2120
2221 canUseIntersectionObserver : canUseDOM && 'IntersectionObserver' in window ,
2322
24- canUseViewport : canUseDOM && ! ! window . screen ,
23+ canUseViewport : canUseDOM && ' screen' in window ,
2524} ;
2625
2726export default ExecutionEnvironment ;
You can’t perform that action at this time.
0 commit comments