getStylesheetsFromDocument
crash on JSDOM: TypeError: Cannot read properties of undefined (reading 'mediaText')
#3753
Labels
ungroomed
Ticket needs a maintainer to prioritize and label
Product
axe-core
Product Version
4.5.0
Latest Version
Issue Description
Expectation
I'm using
axe-core
injsdom
environment when testing UIs withjest-axe
. When updatingaxe-core
from4.4.3
to4.5.0
a new error started to show up in logs.Actual
The
getStylesheetsFromDocument
function crashes whensheet.media.mediaText
is run. Thecssom
package used byjsdom
does not implementStyleSheet.media
, NV/CSSOM#1.axe-core/lib/core/utils/preload-cssom.js
Lines 182 to 193 in c1af750
How to Reproduce
Here is really minimal reproduction case with
getStylesheetsFromDocument
copied fromaxe-core
to demonstrate the issue:Additional context
cssom
is unmaintained and the linked issue is 12 years old. I know adding such work-arounds inaxe-core
's sources is not ideal, but as everything has been working nicely for many years, I hope this small fix could be applied.The text was updated successfully, but these errors were encountered: