From e92d10445bc60af48dc9e4ae87b40d4193762ab9 Mon Sep 17 00:00:00 2001 From: Kevin Read Date: Fri, 17 Nov 2023 16:34:20 +0100 Subject: [PATCH] fix: Guard access to window in helpers.dom.ts for browserless rendering (#11588) --- 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 ebd8d978d..c83712983 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 } -- 2.47.3