mirror of
https://github.com/zebrajr/react.git
synced 2026-01-15 12:15:22 +00:00
fix[devtools]: feature-check document with typeof instead of direct reference (#35343)
Follow-up to https://github.com/facebook/react/pull/35296. We can get `ReferenceError` if this is unavailable. Using `typeof` check instead for safety.
This commit is contained in:
@@ -96,8 +96,11 @@ export default function setupHighlighter(
|
||||
applyingScroll = false;
|
||||
}
|
||||
|
||||
// $FlowFixMe[method-unbinding]
|
||||
if (document && typeof document.addEventListener === 'function') {
|
||||
if (
|
||||
typeof document === 'object' &&
|
||||
// $FlowFixMe[method-unbinding]
|
||||
typeof document.addEventListener === 'function'
|
||||
) {
|
||||
document.addEventListener('scroll', () => {
|
||||
if (!scrollTimer) {
|
||||
// Periodically synchronize the scroll while scrolling.
|
||||
|
||||
Reference in New Issue
Block a user