Skip to content

Commit

Permalink
fix: ignore stylesheets fetching style tag in jsdom (#4138)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
EduSantosBrito and straker committed Sep 5, 2023
1 parent a7e5383 commit d7c16a4
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/core/utils/preload-cssom.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}, [])
);
Expand Down

0 comments on commit d7c16a4

Please sign in to comment.