jsdom
31.0.1 · 13 Nov 2026MIT166.8M / weekRepositoryHomepagenpmAtom feed
5.6.1 is the newest release of 5.x.
In short
3 new2 fixed3 changed
Release note
This is a pretty exciting release! It includes a couple features I never really anticipated jsdom being awesome enough to have, but our wonderful contributors powered through and made them happen anyway:
Added support for the default HTML stylesheet when using
window.getComputedStyle!Notably, this makes jQuery's
show()andhide()methods now work correctly; see #994.
Added support for named properties on
window: any elements with anidattribute, or certain elements with anameattribute, will cause properties to show up on thewindow, and thus as global variables within the jsdom.Although this is fairly unfortunate browser behavior, it's standardized and supported everywhere, so the fact that jsdom now supports this too means we can run a lot of scripts that would previously fail.
Previously, we only supported this for
<iframe>s, and our implementation was quite buggy: e.g.,<iframe name="addEventListener">would overridewindow.addEventListener.Now that we have the infrastructure in place, we anticipate expanding our support so that this works on e.g.
HTMLFormElements as well in the future.
We also have a bunch more fixes and additions:
Implemented the
NonDocumentTypeChildNodemixin. Practically, this means addingnextElementSiblingandpreviousElementSiblingtoElementand the various types ofCharacterData.Updated
StyleSheetListto inherit fromArray, as per the latest CSSOM spec.Overhauled the handling of attributes throughout the DOM, to follow the spec more exactly.
Our
NamedNodeMapimplementation is up to date, as are the variousElementmethods; other places in the code that deal with attributes now all go through a spec-compliant set of helpers.Some weirdnesses around the
styleattribute were fixed along the way; see e.g. #1109.However,
Attrobjects themselves are not yet spec-compliant (e.g., they still inherit fromNode). That's coming soon.
Fixed an unfortunate bug where
getElementByIdwould fail to work correctly on<img>elements whoseidattributes were modified.Fixed the
virtualConsoleoption to work withjsdom.env, not justjsdom.jsdom.Removed a few functions that were erroneously added to
window:mapper,mapDOMNodes, andvisitTree.
A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.