jsdom
31.0.1 · 13 Nov 2026MIT166.8M / weekRepositoryHomepagenpmAtom feed
6.5.1 is the newest release of 6.x.
In short
1 removed2 new9 fixed3 changed
- Removed
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.
Release note
Added a fully spec-compliant implementation of
window.atobandwindow.btoa.Fixed many issues with our
<canvas>implementation:With the
canvasnpm package installed,<canvas>elements are now properlyinstanceof HTMLCanvasElementandinstanceof HTMLElement.<canvas>elements now present the same uniform spec-compliant API both with and without thecanvasnpm package installed. If the package is not installed, some of the methods will cause not-implementedjsdomErrorevents to be emitted on the virtual console.The
widthandheightproperties now correctly reflect thewidthandheightattributes, and have the appropriate default values of300and150.With the
canvasnpm package installed,<canvas>elements now generally play better with other parts of jsdom, e.g.,document.getElementByIdactually works with them.
Introduced and upated many of our element classes, so that at least every tag name/element class pair is now correct, even if some of the classes are stubs. In particular:
Complete implementations were added for
HTMLDataElement,HTMLSpanElement, andHTMLTimeElement.Stubs were added for
HTMLDataListElement,HTMLDialogElement,HTMLEmbedElement,HTMLMeterElement,HTMLOutputElement,HTMLProgressElement,HTMLSourceElement,HTMLTemplateElement, andHTMLTrackElement.HTMLAudioElementwas implemented in full, although itsHTMLMediaElementbase, where most of its functionality is, is still largely a stub.HTMLTableSectionElement,HTMLTableRowElement,HTMLTableCellElement,HTMLTableDataCellElement, andHTMLTableHeaderCellElementwere updated to the latest spec.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.Appropriate constants were added to
HTMLMediaElement.
Updated everything having to do with base URLs to be per-spec:
Added
Node.prototype.baseURIproperty to get the node's owner document's base URL.HTMLBaseElement'shrefgetter now contains appropriate fallbacks and always returns an absolute URL, per spec.If there are no
baseelements in an"about:blank"iframe document, the base URL correctly falls back to the parent window's base URL.
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.So for example, providing
url: "http://example.com"will meandocument.URLreturns"http://example.com/", with a trailing slash.In a future major release, we will start throwing if strings that cannot be parsed as valid absolute URL are provided for this option.
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.