diff --git a/src/helpers/helpers.dom.ts b/src/helpers/helpers.dom.ts index ebd8d978d91..c83712983ac 100644 --- a/src/helpers/helpers.dom.ts +++ b/src/helpers/helpers.dom.ts @@ -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 }