jsdom v5.4.0 Release Notes
-
🚀 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
! (akhaku)- Notably, this makes jQuery's
show()
andhide()
methods now work correctly; see #994.
- Notably, this makes jQuery's
- ➕ Added support for named properties on
window
: any elements with anid
attribute, or certain elements with aname
attribute, will cause properties to show up on thewindow
, and thus as global variables within the jsdom. (Joris-van-der-Wel)- 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.
HTMLFormElement
s as well in the future.
🛠 We also have a bunch more fixes and additions:
- Implemented the
NonDocumentTypeChildNode
mixin. Practically, this means addingnextElementSibling
andpreviousElementSibling
toElement
and the various types ofCharacterData
. (brandon-bethke-neudesic) - 💅 Updated
StyleSheetList
to inherit fromArray
, as per the latest CSSOM spec. - Overhauled the handling of attributes throughout the DOM, to follow the spec more exactly.
- Our
NamedNodeMap
implementation is up to date, as are the variousElement
methods; other places in the code that deal with attributes now all go through a spec-compliant set of helpers. - Some weirdnesses around the
style
attribute were fixed along the way; see e.g. #1109. - However,
Attr
objects themselves are not yet spec-compliant (e.g., they still inherit fromNode
). That's coming soon.
- Our
- 🛠 Fixed an unfortunate bug where
getElementById
would fail to work correctly on<img>
elements whoseid
attributes were modified. (Joris-van-der-Wel) - 🛠 Fixed the
virtualConsole
option to work withjsdom.env
, not justjsdom.jsdom
. (jeffcarp) - ✂ Removed a few functions that were erroneously added to
window
:mapper
,mapDOMNodes
, andvisitTree
. (Joris-van-der-Wel)
- ➕ Added support for the default HTML stylesheet when using