From c7046d5388a1d5eabbc8434906909c83f09e712f Mon Sep 17 00:00:00 2001 From: Kevin Read Date: Tue, 26 Sep 2023 14:46:18 +0200 Subject: [PATCH] fix: Guard access to window in helpers.dom.ts for browserless rendering --- src/helpers/helpers.dom.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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 }