fix: Guard access to window in helpers.dom.ts for browserless rendering (#11588)

This commit is contained in:
Kevin Read
2023-11-17 16:34:20 +01:00
committed by GitHub
parent 2a03e138e9
commit e92d10445b

View File

@@ -262,8 +262,10 @@ export const supportsEventListenerOptions = (function() {
}
} as EventListenerOptions;
window.addEventListener('test', null, options);
window.removeEventListener('test', null, options);
if (_isDomSupported()) {
window.addEventListener('test', null, options);
window.removeEventListener('test', null, options);
}
} catch (e) {
// continue regardless of error
}