Releases: jsdom/jsdom
Version 27.0.0-beta.1
Breaking changes:
- Node.js v20+ is now the minimum supported version.
- The user agent stylesheet is now derived from the HTML Standard, instead of from Chromium. This might change the results you see from
getComputedStyle()
. - The virtual console has seen a number of changes:
"jsdomError"
events are now documented, with specifictype
properties and other properties that depend on the type.sendTo()
was renamed toforwardTo()
.- The
jsdomErrors
option tosendTo()
can be used to control which errors are sent to the Node.js console. This replaces the previousomitJSDOMErrors
boolean option. "jsdomError"
s for failedXMLHttpRequest
fetches are no longer emitted.- The values that are printed when forwarding
"jsdomError"
s to the Node.js console are streamlined.
Other changes:
- Fixed the
ElementInternals
accessibility getters and setters. (They were introduced in v23.1.0, but due to inadequate test coverage never actually worked.) - Fixed using
Object.defineProperty()
on certain objects, such asHTMLSelectElement
instances.
Version 27.0.0-beta.0
This release includes several changes that might be disruptive, and so are being tested as a beta release before the next major release. Hopefully, they will not be breaking, but your help testing would be appreciated.
New selector engine
Mostly notably, this switches our CSS selector engine from nwsapi
to @asamuzakjp/dom-selector
. This was attempted back in 23.2.0, but reverted in 24.0.0 because of performance concerns. Since that time, @asamuzakjp/dom-selector
has improved its performance significantly. On the real-world benchmarks from #3659, we see the new version taking 1.1x as long (compared to 1.5x with the previous attempt). We hope this lower performance overhead will be enough to allow us to stick with the new selector engine. As a sample of how much more capable it is, 19 independent selector-related bugs were closed by merging in this new version.
Please test with the new selector engine and report back with any performance concerns on the issue tracker, ideally before we make the next stable release.
New event constructors
The other major change in this prerelease is the addition of many new event constructors. Previously, we have avoided implementing event constructors unless we implemented their attendant specification. For example, we did not implement BeforeUnloadEvent
since we don't implement unloading of documents; we did not implement BlobEvent
since we did not implement the MediaStream Recording specification; etc. However, these are common popular requests, and so we've chosen to implement these event constructors without implementing their related specifications.
If this causes you any problems, e.g. due to breaking feature detection, please open an issue on the issue tracker, ideally before we make the next stable release.
The full list of implemented event constructors is: BeforeUnloadEvent
, BlobEvent
, DeviceMotionEvent
(omitting requestPermission()
), DeviceOrientationEvent
(omitting requestPermission()
), PointerEvent
, PromiseRejectionEvent
, and TransitionEvent
.
Additional changes
The following non-breaking changes are included in this release:
- Added
movementX
andmovementY
toMouseEvent
. (These are from the Pointer Lock specification, the rest of which is not implemented.) - Changed
element.click()
to fire aPointerEvent
instead of aMouseEvent
. - Changed certain events to be passive by default.
- Fixed
document.createEvent()
to accept a more correct set of event names.
Version 26.1.0
- Added at least partial support for various SVG elements and their classes:
<defs>
(SVGDefsElement
),<desc>
(SVGDescElement
),<g>
(SVGGElement
),<metadata>
(SVGMetadataElement
),<switch>
(SVGSwitchElement
), and<symbol>
(SVGSymbolElement
). - Added
SVGAnimatedPreserveAspectRatio
andSVGAnimatedRect
, including support in the reflection layer. - Added the
SVGSVGElement
createSVGRect()
method, and theSVGRect
type (which is distinct fromDOMRect
.) - Added indexed property support to
HTMLFormElement
. - Updated the
SVGElement
viewportElement()
method to correctly establish the viewport based on ancestor elements. - Removed the now-bloated
form-data
dependency in favor of our own smaller implementation ofmultipart/form-data
serialization. No functional changes are expected. - Various performance improvements, caches, microoptimizations, and deferred object creation.
Version 26.0.0
Breaking change: canvas
peer dependency requirement has been upgraded from v2 to v3. (sebastianwachter)
Other changes:
- Added
AbortSignal.any()
. (jdbevan) - Added initial support for form-associated custom elements, in particular making them labelable and supporting the
ElementInternals
labels
property. The form-associated callbacks are not yet supported. (hesxenon) - Updated
whatwg-url
, adding support forURL.parse()
. - Updated
cssstyle
andrrweb-cssom
, to improve CSS parsing capabilities. - Updated
nwsapi
, improving CSS selector matching. - Updated
parse5
, fixing a bug around<noframes>
elements and HTML entity decoding. - Fixed
JSDOM.fromURL()
to properly reject the returned promise if the server redirects to an invalid URL, instead of causing an uncaught exception.
Version 25.0.1
- Updated dependencies, notably
tough-cookie
, which no longer prints a deprecation warning.
Version 25.0.0
This major release changes the prototype of a jsdom's EventTarget.prototype
to point to the Object.prototype
inside the jsdom, instead of pointing to the Node.js Object.prototype
. Thus, the prototype chain of Window
stays entirely within the jsdom, never crossing over into the Node.js realm.
This only occurs when runScripts
is set to non-default values of "dangerously"
or "outside-only"
, as with the default value, there is no separate Object.prototype
inside the jsdom.
This will likely not impact many programs, but could cause some changes in instanceof
behavior, and so out of an abundance of caution, we're releasing it as a new major version.
Version 24.1.3
- Fixed calls to
postMessage()
that were done as a bare property (i.e.,postMessage()
instead ofwindow.postMessage()
).
Version 24.1.2
- Fixed an issue with the
in
operator applied toEventTarget
methods, e.g.'addEventListener' in window
, which only appeared in Node.js β₯22.5.0. (legendecas) - Fixed the events fired by
blur()
: it no longer firesfocus
andfocusin
on theDocument
, andblur
andfocusout
no longer have theirrelatedTarget
property set. (asamuzaK)
Version 24.1.1
- Fixed selection methods to trigger the
selectionchange
event on theDocument
object. (piotr-oles)
Version 24.1.0
- Added the
getSetCookie()
method to theHeaders
class. (ushiboy) - Fixed the creation and parsing of elements with names from
Object.prototype
, like"constructor"
or"toString"
. - Updated
rweb-cssom
, which can now parse additional CSS constructs.