From 98a0c7e0f7ee6c816b26a0ef71334461eb91925d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ari=20Perkki=C3=B6?= Date: Fri, 28 Oct 2022 11:57:28 +0000 Subject: [PATCH 1/2] fix: prevent crash on jsdom - cssom package does not implement StyleSheet.media --- lib/core/utils/preload-cssom.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/core/utils/preload-cssom.js b/lib/core/utils/preload-cssom.js index 43c2ffcc24..c919d023c4 100644 --- a/lib/core/utils/preload-cssom.js +++ b/lib/core/utils/preload-cssom.js @@ -187,9 +187,13 @@ function getStylesheetsFromDocumentFragment(rootNode, convertDataToStylesheet) { * @returns {Array} */ function getStylesheetsFromDocument(rootNode) { - return Array.from(rootNode.styleSheets).filter(sheet => - filterMediaIsPrint(sheet.media.mediaText) - ); + return Array.from(rootNode.styleSheets).filter(sheet => { + if (!sheet.media) { + return false; + } + + return filterMediaIsPrint(sheet.media.mediaText); + }); } /** From 622bb5a4b9fc6b9f557974c58258879c75e3deac Mon Sep 17 00:00:00 2001 From: Steven Lambert Date: Tue, 1 Nov 2022 08:09:05 -0600 Subject: [PATCH 2/2] trigger build?