From d7c16a481d5a5f68c1e970040e01f125b2025378 Mon Sep 17 00:00:00 2001 From: Eduardo Santos de Brito Date: Tue, 5 Sep 2023 16:36:21 +0200 Subject: [PATCH] fix: ignore stylesheets fetching style tag in jsdom (#4138) * fix: ignore stylesheets fetching when is a inline style * chore: update comment for jsdom issue Co-authored-by: Steven Lambert <2433219+straker@users.noreply.github.com> --------- Co-authored-by: Steven Lambert <2433219+straker@users.noreply.github.com> --- lib/core/utils/preload-cssom.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/core/utils/preload-cssom.js b/lib/core/utils/preload-cssom.js index c919d023c4..7f5fab5db6 100644 --- a/lib/core/utils/preload-cssom.js +++ b/lib/core/utils/preload-cssom.js @@ -173,7 +173,11 @@ function getStylesheetsFromDocumentFragment(rootNode, convertDataToStylesheet) { isLink, root: rootNode }); - out.push(stylesheet.sheet); + // prevent error in jsdom with style elements not having a `sheet` property + // @see https://github.com/jsdom/jsdom/issues/3179 + if(stylesheet.sheet) { + out.push(stylesheet.sheet); + } return out; }, []) );