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 anidattribute, or certain elements with anameattribute, 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.
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. (@brandon-bethke-neudesic) - 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.
- Our
- Fixed an unfortunate bug where
getElementByIdwould fail to work correctly on<img>elements whoseidattributes were modified. (@Joris-van-der-Wel) - Fixed the
virtualConsoleoption 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)