jsdom
31.0.1 · 13 Nov 2026MIT166.8M / weekRepositoryHomepagenpmAtom feed
Upgrading jsdom From 6.0.1 to 6.5.1
6 releases in betweenevery note read
- 1
- change to make
- 0
- advisories fixed
- 8
- new
- 13
- fixes
Before you upgrade
Tick each one off as you go- Breaking6.3.0
Release by release
- Fixed
Fixed an issue where with
jsdom.jsdom, you had to passreferrerandcookieoptions as top-level, whereas withjsdom.env, you had to nest them under adocumentoption. This was unnecessarily confusing. Now both possibilities are allowed for both functions. (The readme only documents the top-level version, though.)
- Fixed
- New
Added
NodeList.prototype[Symbol.iterator], so you can now usefor-ofloops withNodeLists.
- New
- New
Added
jsdom.nodeLocation(node)to get the location within the source text of a given node. - New
Added
jsdom.reconfigureWindow(window, { top })to allow changing the value of a window'stopproperty. - New
Added the
elementargument to the custom resource loader, so you can customize resource loads depending on which element loaded them.
- New
- Breaking
HTMLIsIndexElementwas removed; it has never been produced by the parser since 1.0.0-pre.1, and so it has been just a vestigial global property. - New
Added a fully spec-compliant implementation of
window.atobandwindow.btoa. - New
Added
Node.prototype.baseURIproperty to get the node's owner document's base URL. - Fixed
With the
canvasnpm package installed,<canvas>elements are now properlyinstanceof HTMLCanvasElementandinstanceof HTMLElement.
- Breaking
- New
Added a full-featured, spec-compliant
Element.prototype.classList, closing out a three-year old issue! - Fixed
Fixed errors when trying to parse invalid doctype declarations, like
<!DOCTYPE>. - Fixed
Fixed spurious
"jsdomError"s that were emitted after callingwindow.close(). - Fixed
Fixed the
DOMSubtreeModifiedevent to fire in more cases. Note that our mutation events implementation remains incomplete, and will eventually be removed (in a major release) once we implement mutation observers.
- New
- New
Added basic implementations of
HTMLMediaElementandHTMLVideoElement, back-ported from Facebook's Jest project.
- New
6 other lines we could not sort, mostly version bumps
- 6.4.0
Updated
getElementsByClassNameto match the spec. It now correctly splits on whitespace to try to find elements with all the given classes; it returns aHTMLCollectioninstead of aNodeList; and it memoizes the result. - 6.4.0
Updated
NodeListandHTMLCollectionto match the spec. The most noticable change is thatHTMLCollectionno longer inherits fromNodeList. - 6.3.0
HTMLBaseElement'shrefgetter now contains appropriate fallbacks and always returns an absolute URL, per spec. - 6.3.0
If there are no
baseelements in an"about:blank"iframe document, the base URL correctly falls back to the parent window's base URL. - 6.3.0
When you provide a
url: ...option tojsdom.jsdom()orjsdom.env(), the given string is now attempted to be resolved as a URL before it is installed asdocument.URL. - 6.2.0
Made
virtualConsole.sendTo(console)forward"jsdomError"s toconsoleby callingconsole.error. This can be turned off by doingvirtualConsole.sendTo(console, { omitJsdomErrors: true }).
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.