Added support for Unicode v18.0.0 in internationalized domain names.
Reduced package size and memory use for CSS property definitions. (@scttcper)
Fixed severe slowdowns when building large DOM trees, including SVG charts with D3, which regressed in v30.1.0. (@cmdcolin)
Fixed exponentially slow reads of empty inherited CSS custom properties in deeply nested documents, and custom properties incorrectly inheriting past an initial reset. (@scttcper)
Fixed getComputedStyle() returning stale results after editing stylesheet declarations, selectors, or media queries, including in imported stylesheets. (@trooney)
Fixed selector matching and computed styles after changes to form control checkedness, indeterminacy, selection, values, and validity, including during form resets and canceled clicks. (@trooney)
Fixed computed styles for :focus, :focus-visible, :focus-within, and selectors containing them after focus changes, including inside focus and blur listeners. (@asamuzaK)
Fixed element.focus() incorrectly focusing elements hidden by 'display', including through shadow hosts and slots, and elements excluded by shadow DOM slot assignment. (@asamuzaK)
Fixed getComputedStyle() throwing for elements without inline-style support, including XML and MathML elements. (@asamuzaK)
Fixed a memory leak where stylesheet parsing retained the last parsed stylesheet's window after window.close().
Fixed memory growth from long-lived MutationObserver instances retaining bookkeeping for garbage-collected nodes. (@scttcper)
Fixed retained select.selectedOptions collections becoming stale after selection changes and form resets.
Fixed rejection of negative CSS sizing values, including for 'min-width', 'min-height', 'max-width', and 'max-height', which regressed in v30.1.0.
Fixed handling of deeply nested color-mix() expressions, including exceptions during color resolution. (@asamuzaK)
Fixed element.matches() and element.closest() failing to match SVG elements such as <foreignObject> and <linearGradient>, which regressed in @asamuzakjp/dom-selector v9.0.3. (@asamuzaK)
Fixed :nth-child(n+B) and :nth-last-child(n+B) matching in element.matches() and stylesheet rules. (@asamuzaK)
Fixed stale selector results for sibling combinators after DOM changes. (@asamuzaK)
Fixed spurious window blur and focusout events and incorrect event.relatedTarget values when focusing an element after removing the previously focused element, which regressed in v30.1.0. (@asamuzaK)
Fixed focus and blur behavior across frames, and focusing the document's viewport through document.documentElement.focus(). (@asamuzaK)
Fixed focus targets removed or disabled by blur listeners becoming active, and text selections made by focus and blur listeners being overwritten. (@asamuzaK)
Fixed element.focus() incorrectly focusing disabled form controls and <input type="hidden"> elements with tabindex="". (@scttcper)
Fixed invalid style.setProperty() calls changing existing !important priorities, serialized styles, or mutation records. (@FedgeNo)
Fixed !important handling when updating CSS longhands after shorthands, using variables or CSS-wide keywords, and assigning style properties directly. (@FedgeNo)
Fixed <noscript> parsing with includeNodeLocations: true or inside frames to honor the runScripts option.
Fixed the storageQuota option being ignored by frames.
Fixed encoding detection of HTML and XML byte input to honor XML encoding declarations and detect UTF-16 without a byte order mark.
Fixed exceptions caused by truncated charset parameters in <meta> elements, and encoding detection incorrectly using incomplete <meta> tags. (@FedgeNo)
Fixed XML serialization errors for namespaces named constructor, toString, __proto__, or "null", and incorrect reuse of namespace prefixes declared on sibling elements.
Fixed element.innerHTML and element.outerHTML in XML documents to reject invalid characters in attribute values and avoid stack overflows on large strings.
Fixed selector matching for :lang(), :nth-child(... of ...) after mutations, and :has() with duplicate IDs or nested logical pseudo-classes. (@asamuzaK)
This release is dedicated to @scttcper, who unleashed @codex upon jsdom and found tons of performance improvements. Along the way, he found and fixed many correctness issues as well.
We really appreciate his thoughtful MRs, which did a great job following the project's contribution guidelines, and were clearly human-curated, with their MR descriptions edited to be brief and respectful of the maintainers' time.
Thanks to @scttcper, as well as all the other contributors of this release (most of whom were AI-assisted).
Added named access to elements on document, such as document.myForm for <form name="myForm">. (@vojtisprime11)
Added QuotaExceededError, including its use for storage quota errors and oversized crypto.getRandomValues() requests.
Added support for the relaxed DOM naming rules when creating elements, attributes, and document types.
Improved performance of DOM construction, tree mutations, range operations, and live collection access, especially on large documents. (@scttcper, @erezrokah)
Improved performance of getComputedStyle(), style changes, and CSS serialization. (@scttcper, @jhult)
Improved performance of event dispatch, form control and label lookups, and updates to <select> elements and radio button groups. (@scttcper)
Reduced memory use when creating and working with DOM nodes, attributes, event listeners, and mutation observers. (@scttcper)
Changed window.close() to preserve access to the document and its DOM through retained references.
Fixed element.querySelectorAll() returning no matches when the first part of the selector matches the element itself, which regressed in v30.0.0. (@asamuzaK)
Fixed case sensitivity in CSS attribute selectors, including selectors matching data-state="", title="", and other case-sensitive values. (@asamuzaK)
Fixed document.querySelector() failing to find a matching element when an earlier element has the same ID but does not match the rest of the selector. (@vojtisprime11)
Fixed :focus matching in shadow trees. (@asamuzaK)
Fixed DOM insertion and replacement, including valid document.replaceChildren() calls, invalid document element and doctype placements, and mutations during element.replaceWith().
Fixed the ordering of script execution, custom element callbacks, iframe loading, and mutation observer notifications during DOM insertion, including in shadow trees.
Fixed queued events and navigation continuing after window.close() or iframe removal, and prevented new scripts, resource loads, timers, and animation frames from starting in destroyed documents. (@scttcper)
Fixed parent documents waiting indefinitely for loading to finish when a child iframe removes itself during loading.
Fixed request cancellation across redirects, during pending requestInterceptor() callbacks, and when reusing an XMLHttpRequest after aborting it.
Fixed resource loading and JSDOM.fromURL() potentially hanging when response handling throws and response stream cleanup does not finish.
Fixed successful cached resource loads being treated as aborted.
Fixed getComputedStyle() and document.styleSheets using the wrong stylesheet order after inserting or updating <style> elements.
Fixed getComputedStyle() ignoring nested @import and @media rules in imported stylesheets, and returning stale results after imports finish loading.
Fixed style invalidation, stylesheet removal, and frame source updates in shadow trees.
Fixed repeated getComputedStyle() calls changing case-sensitive background URLs, and inconsistent resolution of border shorthands containing system colors. (@scttcper)
Fixed computed border widths, including borderless elements incorrectly reporting 16px, which regressed in v30.0.0. (@Alberto-BaseNet)
Fixed getComputedStyle() to resolve 'font-weight' keywords to numeric values. (@tianrking)
Fixed getComputedStyle() to convert lengths to pixels inside CSS math functions containing percentages, and to resolve percentages in 'font-size' math functions. (@soroushm)
Fixed serialization of min() and max() containing nested calc(), which regressed in v30.0.0. (@asamuzaK)
Fixed CSS values mixing lengths or percentages with math functions, such as 'grid-template-columns' values containing both 100px and calc(). (@rome-xi)
Fixed parsing of 'background' and 'border' shorthands with adjacent components, such as url(a.png)no-repeat, including a crash when parsing inline styles. Also fixed handling of invalid shorthand assignments and escaped or unusual characters in CSS declarations. (@asamuzaK)
Fixed parsing of unitless zero values in 'flex' shorthands, such as 35 1 0, and rejection of negative 'flex-basis' lengths and percentages. (@asamuzaK)
Fixed shorthand style assignments producing extra mutation records and custom element callbacks for intermediate values. (@scttcper)
Fixed Range and Selection handling of CDATA sections, including boundary offsets and range cloning, extraction, deletion, insertion, and stringification. (@scttcper)
Fixed text.normalize() incorrectly removing the text node or merging its siblings. (@scttcper)
Fixed cloning and importing CDATA sections and processing instructions whose contents have been modified, and serialization of CDATA sections adopted into HTML documents.
Fixed stale named-property collections on window, and incorrect named access from empty or namespaced id="" and name="" values. (@scttcper)
Fixed elements in documents created with DOMParser or document.implementation.createHTMLDocument() appearing as named properties on window and being retained in memory. (@Iaotle)
Fixed storage events being sent to windows created after the storage change, and ensured surviving recipients still receive events when the source document is destroyed.
Fixed attribute lookups after namespace prefix changes, and namespaced attributes incorrectly affecting ID lookups and element behavior. (@scttcper)
Fixed input.list in detached element trees. (@scttcper)
Fixed attr.ownerDocument after setting an attribute node on an element in another document or adopting its element. (@Kjubikstronk)
Fixed fresh element.getElementsByTagName() calls using the previous document's case-sensitivity rules after adoption between HTML and XML documents. (@Kjubikstronk)
Fixed element.tagName returning stale casing after adoption between HTML and XML documents.
Fixed radio button grouping and checkedness updates for controls with different form owners, controls outside their form, unnamed controls, and canceled clicks.
Fixed <select> selection updates when moving options, and unintended selection resets when moving a whole <select> or changing unrelated descendants.
Fixed cloning <input> elements to preserve input.indeterminate.
Fixed focus state after removing a focused element or its ancestor, including inside shadow trees.
Fixed script execution when inserting children into a connected, empty <script>. (@Kjubikstronk)
Fixed incorrect script execution after changes to src="", and handling of type="", for="", and event="".
Fixed document.currentScript during nested script execution and scripts in shadow trees.
Fixed event dispatch, window.event, and default passive listener handling for non-node event targets, and event dispatch when user code modifies window.constructor.
Fixed volumechange and ratechange events to fire asynchronously. (@christianaurichzm)
Fixed DOM APIs accepting user-created proxies around DOM objects where genuine DOM objects are required.
Fixed XPath iterator invalidation after DOM mutations and errors for invalid result types.
Fixed NodeIterator traversal when its filter removes nodes.
Fixed fileReader.readAsText() to honor the blob's MIME type charset when no supported explicit encoding is supplied.
Fixed fractional seconds in time input parsing and serialization. (@Jaybhade)
Fixed large input.valueAsNumber assignments for time and local date/time inputs.
Fixed hard wrapping of <textarea> values to use the numeric textarea.cols value.
Fixed document.readyState to be "complete" for documents created with document.implementation.createDocument() and document.implementation.createHTMLDocument().
Fixed element.translate for empty translate="" values and elements without a parent.
Fixed XML parsing of lone surrogates to replace them with the Unicode replacement character.
Fixed node.lookupNamespaceURI() for the xml and xmlns prefixes. (@vojtisprime11)
Fixed <base> elements to ignore data: and javascript: URLs. (@vojtisprime11)
Significantly improved and sped up getComputedStyle(). Computed value rules are now applied across a broader set of properties, and include fixes related to inheritance, defaulting keywords, custom properties, and color-related values such as currentcolor and system colors. (@asamuzaK)
Fixed CSS 'background' and 'border' shorthand parsing. (@asamuzaK)
Node.js v22.13.0+ is now the minimum supported v22 version (was v22.12.0+).
Other changes:
Overhauled the CSSOM implementation, replacing the @acemir/cssom and cssstyle dependencies with fresh internal implementations built on webidl2js wrappers and the css-tree parser. Serialization, parsing, and API behavior is improved in various ways, especially around edge cases.
Added CSSCounterStyleRule and CSSNamespaceRule to jsdom Windows.
Added cssMediaRule.matches and cssSupportsRule.matches getters.
Added proper media query parsing in MediaList, using css-tree instead of naive comma-splitting. Invalid queries become "not all" per spec.
Added blob.text(), blob.arrayBuffer(), and blob.bytes() methods.
Improved getComputedStyle() to account for CSS specificity when multiple rules apply. (@asamuzaK)
Improved synchronous XMLHttpRequest performance by using a persistent worker thread, avoiding ~400ms of setup overhead on every synchronous request after the first one.
Improved performance of node.getRootNode(), node.isConnected, and event.dispatchEvent() by caching the root node of document-connected trees.
Fixed getComputedStyle() to correctly handle !important priority. (@asamuzaK)
Fixed document.getElementById() to return the first element in tree order when multiple elements share the same ID.
Fixed <svg> elements to no longer incorrectly proxy event handlers to the Window.
Fixed FileReader event timing and fileReader.result state to more closely follow the spec.
Fixed a potential hang when synchronous XMLHttpRequest encountered dispatch errors.
Fixed compatibility with environments where Node.js's built-in fetch() has been used before importing jsdom, by working around undici v6/v7 incompatibilities.
Overhauled resource loading customization. See the new README for details on the new API.
Added MIME type sniffing to <iframe> and <frame> loads.
Regression: WebSockets are no longer correctly throttled to one connection per origin. This is a result of the bug at nodejs/undici#4743.
Fixed decoding of the query components of <a> and <area> elements in non-UTF-8 documents.
Fixed XMLHttpRequest fetches and WebSocket upgrade requests to be interceptable by the new customizable resource loading. (Except synchronous XMLHttpRequests.)
Fixed the referrer of a document to be set correctly when redirects are involved; it is now the initiating page, not the last hop in the redirect chain.
Fixed correctness bugs when passing ArrayBuffers or typed arrays to various APIs, where they would not correctly snapshot the data.
Fixed require("url").parse() deprecation warning when using WebSockets.
Fixed <iframe>, <frame>, and <img> (when canvas is installed) to fire load events, not error events, on non-OK HTTP responses.
Improved CSS parsing by switching to @acemir/cssom, including support for nested selectors, nested declarations, layer statements, and improved at-rule validation. (@acemir)
Fixed some selector cache invalidation issues where changes to attributes were not being picked up. (@asamuzaK)
Fixed package.json"engines" field to reflect the new minimum Node.js versions needed to run jsdom, as noted in the changelog for v27.0.1.
This release inadvertently raised the minimum Node.js version from v20.0.0 to v20.19.0+, v22.12.0+, v24.0.0+. (This happened via a dependency update.) This probably should have been a breaking (major) change, instead of happening in a patch version, since it prevents using earlier Node.js versions.
After further testing, we found that most of our development dependencies also require these versions, and so it's not feasible for the jsdom project to support earlier Node.js versions. (For example, our testing frameworks will not run on them.) If you need to use such earlier versions, or otherwise are working in an environment which gives related errors such as ERR_REQUIRE_ESM, then please stick with the v26.1.0 release of jsdom. (Noting, of course, that such versions are unsupported, and we will not respond to bug reports opened against them.)
Subsequent jsdom releases will explicitly require these minimum Node.js versions, and will have CI testing to ensure that the minimum version is not accidentally raised again.
Normal changelog:
Fixed some regressions in CSS selectors. Most such regression fixes were done in a minor update of a dependency, and thus available for all fresh installs of v27.0.0. However, one related to class="" attribute changes is only possible with a new version of jsdom. (@asamuzaK)
Added a variety of event constructors, even though we do not implement their associated specifications or ever fire them: BeforeUnloadEvent, BlobEvent, DeviceMotionEvent (omitting requestPermission()), DeviceOrientationEvent (omitting requestPermission()), PointerEvent, PromiseRejectionEvent, and TransitionEvent.
Added movementX and movementY to MouseEvent. (These are from the Pointer Lock specification, the rest of which is not implemented.)
"jsdomError" events are now documented, with specific type properties and other properties that depend on the type.
sendTo() was renamed to forwardTo().
The jsdomErrors option to forwardTo() can be used to control which errors are sent to the Node.js console. This replaces the previous omitJSDOMErrors boolean option.
"jsdomError"s for failed XMLHttpRequest fetches are no longer emitted.
The values that are printed when forwarding "jsdomError"s to the Node.js console are streamlined.
Upgraded tough-cookie, which now considers URLs like http://localhost/ to be secure contexts (per the spec), and thus will return Secure-flagged cookies for such URLs. (@colincasey)
Upgraded cssstyle, which brings along many improvements and fixes to the CSSStyleDeclaration object and its properties.
Updated the user agent stylesheet to be derived from the HTML Standard, instead of from an old revision of Chromium.
Changed element.click() to fire a PointerEvent instead of a MouseEvent.
Changed certain events to be passive by default.
Changed the <input> element's pattern="" attribute to use the v regular expression flag, instead of u.
Fixed many specification conformance issues with the Window object, including named properties and changing various data properties to accessor properties.
Fixed document.createEvent() to accept a more correct set of event names.
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 as HTMLSelectElement instances.
Fixed jsdom.reconfigure({ url }) not updating document.baseURI or properties derived from it. (This regressed in v26.1.0.)
Fixed CSS system colors, as well as the initial, inherit, and unset keywords, to resolve correctly. (@asamuzaK)
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 and SVGAnimatedRect, including support in the reflection layer.
Added the SVGSVGElementcreateSVGRect() method, and the SVGRect type (which is distinct from DOMRect.)
Added indexed property support to HTMLFormElement.
Updated the SVGElementviewportElement() method to correctly establish the viewport based on ancestor elements.
Removed the now-bloated form-data dependency in favor of our own smaller implementation of multipart/form-data serialization. No functional changes are expected.
Various performance improvements, caches, microoptimizations, and deferred object creation.
Added initial support for form-associated custom elements, in particular making them labelable and supporting the ElementInternalslabels property. The form-associated callbacks are not yet supported. (@hesxenon)
Updated whatwg-url, adding support for URL.parse().
Updated cssstyle and rrweb-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.
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.
Fixed an issue with the in operator applied to EventTarget 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 fires focus and focusin on the Document, and blur and focusout no longer have their relatedTarget property set. (@asamuzaK)
Since reverting to nwsapi causes several functionality regressions, e.g. removing :has() support, we've decided to make this a major version.
Additionally:
Small fixes to edge-case behavior of the following properties: input.maxLength, input.minLength, input.size, progress.max, tableCell.colSpan, tableCell.rowSpan, tableCol.span, textArea.cols, textArea.maxLength, textArea.minLength, textArea.rows.
This release switches our CSS selector engine from nwsapi to @asamuzakjp/dom-selector. The new engine is more actively maintained, and supports many new selectors: see the package's documentation for the full list. It also works better with shadow trees.
There is a potential of a performance regression due to this change. In our stress test benchmark, which runs most of these 273 selectors against this 128 KiB document, the new engine completes the benchmark only 0.25x as fast. However, we're hopeful that in more moderate usage this will not be a significant issue. Any help speeding up @asamuzakjp/dom-selector is appreciated, and feel free to open an issue if this has had a significant impact on your project.
Added an initial implementation of ElementInternals, including the shadowRoot getter and the string-valued ARIA properties. (@zjffun)
Added the string-valued ARIA attribute-reflecting properties to Element.
Fixed history.pushState() and history.replaceState() to follow the latest specification, notably with regards to how they handle empty string inputs and what new URLs are possible.
Fixed the input.valueAsANumber setter to handle NaN correctly. (@alexandertrefz)
Updated various dependencies, including cssstyle which contains several bug fixes.
This MR contains the following updates:
| Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) |
|---|---|---|---|
| [jsdom](https://github.com/jsdom/jsdom) | [`^22.0.0` → `^30.0.0`](https://renovatebot.com/diffs/npm/jsdom/22.1.0/30.1.2) |  |  |
---
### Release Notes
<details>
<summary>jsdom/jsdom (jsdom)</summary>
### [`v30.1.2`](https://github.com/jsdom/jsdom/releases/tag/v30.1.2)
[Compare Source](https://github.com/jsdom/jsdom/compare/v30.1.1...v30.1.2)
- Added support for Unicode v18.0.0 in internationalized domain names.
- Reduced package size and memory use for CSS property definitions. ([@​scttcper](https://github.com/scttcper))
- Fixed severe slowdowns when building large DOM trees, including SVG charts with D3, which regressed in v30.1.0. ([@​cmdcolin](https://github.com/cmdcolin))
- Fixed exponentially slow reads of empty inherited CSS custom properties in deeply nested documents, and custom properties incorrectly inheriting past an `initial` reset. ([@​scttcper](https://github.com/scttcper))
- Fixed `getComputedStyle()` returning stale results after editing stylesheet declarations, selectors, or media queries, including in imported stylesheets. ([@​trooney](https://github.com/trooney))
- Fixed selector matching and computed styles after changes to form control checkedness, indeterminacy, selection, values, and validity, including during form resets and canceled clicks. ([@​trooney](https://github.com/trooney))
- Fixed computed styles for `:focus`, `:focus-visible`, `:focus-within`, and selectors containing them after focus changes, including inside focus and blur listeners. ([@​asamuzaK](https://github.com/asamuzaK))
- Fixed `element.focus()` incorrectly focusing elements hidden by 'display', including through shadow hosts and slots, and elements excluded by shadow DOM slot assignment. ([@​asamuzaK](https://github.com/asamuzaK))
- Fixed `getComputedStyle()` throwing for elements without inline-style support, including XML and MathML elements. ([@​asamuzaK](https://github.com/asamuzaK))
- Fixed a memory leak where stylesheet parsing retained the last parsed stylesheet's window after `window.close()`.
- Fixed memory growth from long-lived `MutationObserver` instances retaining bookkeeping for garbage-collected nodes. ([@​scttcper](https://github.com/scttcper))
- Fixed retained `select.selectedOptions` collections becoming stale after selection changes and form resets.
- Fixed rejection of negative CSS sizing values, including for 'min-width', 'min-height', 'max-width', and 'max-height', which regressed in v30.1.0.
- Fixed handling of deeply nested `color-mix()` expressions, including exceptions during color resolution. ([@​asamuzaK](https://github.com/asamuzaK))
- Fixed `element.matches()` and `element.closest()` failing to match SVG elements such as `<foreignObject>` and `<linearGradient>`, which regressed in `@asamuzakjp/dom-selector` v9.0.3. ([@​asamuzaK](https://github.com/asamuzaK))
- Fixed `:nth-child(n+B)` and `:nth-last-child(n+B)` matching in `element.matches()` and stylesheet rules. ([@​asamuzaK](https://github.com/asamuzaK))
- Fixed stale selector results for sibling combinators after DOM changes. ([@​asamuzaK](https://github.com/asamuzaK))
### [`v30.1.1`](https://github.com/jsdom/jsdom/releases/tag/v30.1.1)
[Compare Source](https://github.com/jsdom/jsdom/compare/v30.1.0...v30.1.1)
- Fixed spurious window `blur` and `focusout` events and incorrect `event.relatedTarget` values when focusing an element after removing the previously focused element, which regressed in v30.1.0. ([@​asamuzaK](https://github.com/asamuzaK))
- Fixed focus and blur behavior across frames, and focusing the document's viewport through `document.documentElement.focus()`. ([@​asamuzaK](https://github.com/asamuzaK))
- Fixed focus targets removed or disabled by `blur` listeners becoming active, and text selections made by focus and blur listeners being overwritten. ([@​asamuzaK](https://github.com/asamuzaK))
- Fixed `element.focus()` incorrectly focusing disabled form controls and `<input type="hidden">` elements with `tabindex=""`. ([@​scttcper](https://github.com/scttcper))
- Fixed invalid `style.setProperty()` calls changing existing `!important` priorities, serialized styles, or mutation records. ([@​FedgeNo](https://github.com/FedgeNo))
- Fixed `!important` handling when updating CSS longhands after shorthands, using variables or CSS-wide keywords, and assigning style properties directly. ([@​FedgeNo](https://github.com/FedgeNo))
- Fixed `<noscript>` parsing with `includeNodeLocations: true` or inside frames to honor the `runScripts` option.
- Fixed the `storageQuota` option being ignored by frames.
- Fixed encoding detection of HTML and XML byte input to honor XML encoding declarations and detect UTF-16 without a byte order mark.
- Fixed exceptions caused by truncated `charset` parameters in `<meta>` elements, and encoding detection incorrectly using incomplete `<meta>` tags. ([@​FedgeNo](https://github.com/FedgeNo))
- Fixed XML serialization errors for namespaces named `constructor`, `toString`, `__proto__`, or `"null"`, and incorrect reuse of namespace prefixes declared on sibling elements.
- Fixed `element.innerHTML` and `element.outerHTML` in XML documents to reject invalid characters in attribute values and avoid stack overflows on large strings.
- Fixed selector matching for `:lang()`, `:nth-child(... of ...)` after mutations, and `:has()` with duplicate IDs or nested logical pseudo-classes. ([@​asamuzaK](https://github.com/asamuzaK))
### [`v30.1.0`](https://github.com/jsdom/jsdom/releases/tag/v30.1.0)
[Compare Source](https://github.com/jsdom/jsdom/compare/v30.0.1...v30.1.0)
jsdom is feeling the AGI!
This release is dedicated to [@​scttcper](https://github.com/scttcper), who unleashed [@​codex](https://github.com/codex) upon jsdom and found tons of performance improvements. Along the way, he found and fixed many correctness issues as well.
We really appreciate his thoughtful MRs, which did a great job following the project's contribution guidelines, and were clearly human-curated, with their MR descriptions edited to be brief and respectful of the maintainers' time.
Thanks to [@​scttcper](https://github.com/scttcper), as well as all the other contributors of this release (most of whom were AI-assisted).
- Added named access to elements on `document`, such as `document.myForm` for `<form name="myForm">`. ([@​vojtisprime11](https://github.com/vojtisprime11))
- Added `QuotaExceededError`, including its use for storage quota errors and oversized `crypto.getRandomValues()` requests.
- Added support for the relaxed DOM naming rules when creating elements, attributes, and document types.
- Improved performance of DOM construction, tree mutations, range operations, and live collection access, especially on large documents. ([@​scttcper](https://github.com/scttcper), [@​erezrokah](https://github.com/erezrokah))
- Improved performance of `getComputedStyle()`, style changes, and CSS serialization. ([@​scttcper](https://github.com/scttcper), [@​jhult](https://github.com/jhult))
- Improved performance of event dispatch, form control and label lookups, and updates to `<select>` elements and radio button groups. ([@​scttcper](https://github.com/scttcper))
- Reduced memory use when creating and working with DOM nodes, attributes, event listeners, and mutation observers. ([@​scttcper](https://github.com/scttcper))
- Changed `window.close()` to preserve access to the document and its DOM through retained references.
- Fixed `element.querySelectorAll()` returning no matches when the first part of the selector matches the element itself, which regressed in v30.0.0. ([@​asamuzaK](https://github.com/asamuzaK))
- Fixed case sensitivity in CSS attribute selectors, including selectors matching `data-state=""`, `title=""`, and other case-sensitive values. ([@​asamuzaK](https://github.com/asamuzaK))
- Fixed `document.querySelector()` failing to find a matching element when an earlier element has the same ID but does not match the rest of the selector. ([@​vojtisprime11](https://github.com/vojtisprime11))
- Fixed `:focus` matching in shadow trees. ([@​asamuzaK](https://github.com/asamuzaK))
- Fixed DOM insertion and replacement, including valid `document.replaceChildren()` calls, invalid document element and doctype placements, and mutations during `element.replaceWith()`.
- Fixed the ordering of script execution, custom element callbacks, iframe loading, and mutation observer notifications during DOM insertion, including in shadow trees.
- Fixed queued events and navigation continuing after `window.close()` or iframe removal, and prevented new scripts, resource loads, timers, and animation frames from starting in destroyed documents. ([@​scttcper](https://github.com/scttcper))
- Fixed parent documents waiting indefinitely for loading to finish when a child iframe removes itself during loading.
- Fixed request cancellation across redirects, during pending `requestInterceptor()` callbacks, and when reusing an `XMLHttpRequest` after aborting it.
- Fixed resource loading and `JSDOM.fromURL()` potentially hanging when response handling throws and response stream cleanup does not finish.
- Fixed successful cached resource loads being treated as aborted.
- Fixed `getComputedStyle()` and `document.styleSheets` using the wrong stylesheet order after inserting or updating `<style>` elements.
- Fixed `getComputedStyle()` ignoring nested `@import` and `@media` rules in imported stylesheets, and returning stale results after imports finish loading.
- Fixed style invalidation, stylesheet removal, and frame source updates in shadow trees.
- Fixed repeated `getComputedStyle()` calls changing case-sensitive background URLs, and inconsistent resolution of border shorthands containing system colors. ([@​scttcper](https://github.com/scttcper))
- Fixed computed border widths, including borderless elements incorrectly reporting `16px`, which regressed in v30.0.0. ([@​Alberto-BaseNet](https://github.com/Alberto-BaseNet))
- Fixed `getComputedStyle()` to resolve `'font-weight'` keywords to numeric values. ([@​tianrking](https://github.com/tianrking))
- Fixed `getComputedStyle()` to convert lengths to pixels inside CSS math functions containing percentages, and to resolve percentages in `'font-size'` math functions. ([@​soroushm](https://github.com/soroushm))
- Fixed serialization of `min()` and `max()` containing nested `calc()`, which regressed in v30.0.0. ([@​asamuzaK](https://github.com/asamuzaK))
- Fixed CSS values mixing lengths or percentages with math functions, such as `'grid-template-columns'` values containing both `100px` and `calc()`. ([@​rome-xi](https://github.com/rome-xi))
- Fixed parsing of `'background'` and `'border'` shorthands with adjacent components, such as `url(a.png)no-repeat`, including a crash when parsing inline styles. Also fixed handling of invalid shorthand assignments and escaped or unusual characters in CSS declarations. ([@​asamuzaK](https://github.com/asamuzaK))
- Fixed parsing of unitless zero values in `'flex'` shorthands, such as `35 1 0`, and rejection of negative `'flex-basis'` lengths and percentages. ([@​asamuzaK](https://github.com/asamuzaK))
- Fixed shorthand style assignments producing extra mutation records and custom element callbacks for intermediate values. ([@​scttcper](https://github.com/scttcper))
- Fixed `Range` and `Selection` handling of CDATA sections, including boundary offsets and range cloning, extraction, deletion, insertion, and stringification. ([@​scttcper](https://github.com/scttcper))
- Fixed `text.normalize()` incorrectly removing the text node or merging its siblings. ([@​scttcper](https://github.com/scttcper))
- Fixed cloning and importing CDATA sections and processing instructions whose contents have been modified, and serialization of CDATA sections adopted into HTML documents.
- Fixed stale named-property collections on `window`, and incorrect named access from empty or namespaced `id=""` and `name=""` values. ([@​scttcper](https://github.com/scttcper))
- Fixed elements in documents created with `DOMParser` or `document.implementation.createHTMLDocument()` appearing as named properties on `window` and being retained in memory. ([@​Iaotle](https://github.com/Iaotle))
- Fixed memory leaks from mutation observers retaining observed nodes, abort signals retaining removed event listeners, and storage event tracking retaining closed windows. ([@​scttcper](https://github.com/scttcper))
- Fixed `storage` events being sent to windows created after the storage change, and ensured surviving recipients still receive events when the source document is destroyed.
- Fixed attribute lookups after namespace prefix changes, and namespaced attributes incorrectly affecting ID lookups and element behavior. ([@​scttcper](https://github.com/scttcper))
- Fixed `input.list` in detached element trees. ([@​scttcper](https://github.com/scttcper))
- Fixed `attr.ownerDocument` after setting an attribute node on an element in another document or adopting its element. ([@​Kjubikstronk](https://github.com/Kjubikstronk))
- Fixed fresh `element.getElementsByTagName()` calls using the previous document's case-sensitivity rules after adoption between HTML and XML documents. ([@​Kjubikstronk](https://github.com/Kjubikstronk))
- Fixed `element.tagName` returning stale casing after adoption between HTML and XML documents.
- Fixed radio button grouping and checkedness updates for controls with different form owners, controls outside their form, unnamed controls, and canceled clicks.
- Fixed `<select>` selection updates when moving options, and unintended selection resets when moving a whole `<select>` or changing unrelated descendants.
- Fixed cloning `<input>` elements to preserve `input.indeterminate`.
- Fixed focus state after removing a focused element or its ancestor, including inside shadow trees.
- Fixed script execution when inserting children into a connected, empty `<script>`. ([@​Kjubikstronk](https://github.com/Kjubikstronk))
- Fixed incorrect script execution after changes to `src=""`, and handling of `type=""`, `for=""`, and `event=""`.
- Fixed `document.currentScript` during nested script execution and scripts in shadow trees.
- Fixed event dispatch, `window.event`, and default passive listener handling for non-node event targets, and event dispatch when user code modifies `window.constructor`.
- Fixed `volumechange` and `ratechange` events to fire asynchronously. ([@​christianaurichzm](https://github.com/christianaurichzm))
- Fixed DOM APIs accepting user-created proxies around DOM objects where genuine DOM objects are required.
- Fixed XPath iterator invalidation after DOM mutations and errors for invalid result types.
- Fixed `NodeIterator` traversal when its filter removes nodes.
- Fixed `fileReader.readAsText()` to honor the blob's MIME type charset when no supported explicit encoding is supplied.
- Fixed fractional seconds in time input parsing and serialization. ([@​Jaybhade](https://github.com/Jaybhade))
- Fixed large `input.valueAsNumber` assignments for time and local date/time inputs.
- Fixed hard wrapping of `<textarea>` values to use the numeric `textarea.cols` value.
- Fixed `document.readyState` to be `"complete"` for documents created with `document.implementation.createDocument()` and `document.implementation.createHTMLDocument()`.
- Fixed `element.translate` for empty `translate=""` values and elements without a parent.
- Fixed XML parsing of lone surrogates to replace them with the Unicode replacement character.
- Fixed `node.lookupNamespaceURI()` for the `xml` and `xmlns` prefixes. ([@​vojtisprime11](https://github.com/vojtisprime11))
- Fixed `<base>` elements to ignore `data:` and `javascript:` URLs. ([@​vojtisprime11](https://github.com/vojtisprime11))
- Fixed `svgElement.viewportElement` inside `<symbol>` elements.
- Fixed the default `blobEvent.timecode` to be `NaN`.
- Fixed the object shape and property descriptors of `CSS`.
### [`v30.0.1`](https://github.com/jsdom/jsdom/releases/tag/v30.0.1)
[Compare Source](https://github.com/jsdom/jsdom/compare/v30.0.0...v30.0.1)
- Fixed `getComputedStyle()` with `calc()` and other functions throwing an exception, which regressed in v30.0.0. ([@​asamuzaK](https://github.com/asamuzaK))
- Sped up up range operations on large documents ([@​leonidaz](https://github.com/leonidaz))
### [`v30.0.0`](https://github.com/jsdom/jsdom/releases/tag/v30.0.0)
[Compare Source](https://github.com/jsdom/jsdom/compare/v29.1.1...v30.0.0)
Breaking changes:
- Node.js minimum version raised to `^22.22.2 || ^24.15.0 || >=26.0.0`.
Other changes:
- Added `CSS.escape()` and `CSS.supports()` functions. ([@​asamuzaK](https://github.com/asamuzaK))
- Added `'background-position-x'` and `'background-position-y'` CSS properties. ([@​olagokemills](https://github.com/olagokemills))
- Fixed `getComputedStyle()` to convert length values into pixels. ([@​asamuzaK](https://github.com/asamuzaK))
- Fixed CSS function serialization, e.g., in the return value of `getPropertyValue()`. ([@​asamuzaK](https://github.com/asamuzaK))
- Fixed the type of error thrown by `document.evaluate()` ([@​dokson](https://github.com/dokson))
### [`v29.1.1`](https://github.com/jsdom/jsdom/releases/tag/v29.1.1)
[Compare Source](https://github.com/jsdom/jsdom/compare/v29.1.0...v29.1.1)
- Fixed `'border-radius'` computed style serialization. ([@​asamuzaK](https://github.com/asamuzaK))
- Fixed computed style computation when using `'background-origin'` and `'background-clip'` CSS properties. ([@​asamuzaK](https://github.com/asamuzaK))
- Significantly optimized initial calls to `getComputedStyle()`, before the cache warms up. ([@​asamuzaK](https://github.com/asamuzaK))
### [`v29.1.0`](https://github.com/jsdom/jsdom/releases/tag/v29.1.0)
[Compare Source](https://github.com/jsdom/jsdom/compare/v29.0.2...v29.1.0)
- Added basic support for the ratio CSS type. ([@​asamuzaK](https://github.com/asamuzaK))
- Fixed `getComputedStyle()` sometimes returning outdated results after CSS was modified. ([@​asamuzaK](https://github.com/asamuzaK))
### [`v29.0.2`](https://github.com/jsdom/jsdom/releases/tag/v29.0.2)
[Compare Source](https://github.com/jsdom/jsdom/compare/v29.0.1...v29.0.2)
- Significantly improved and sped up `getComputedStyle()`. Computed value rules are now applied across a broader set of properties, and include fixes related to inheritance, defaulting keywords, custom properties, and color-related values such as `currentcolor` and system colors. ([@​asamuzaK](https://github.com/asamuzaK))
- Fixed CSS `'background`' and `'border'` shorthand parsing. ([@​asamuzaK](https://github.com/asamuzaK))
### [`v29.0.1`](https://github.com/jsdom/jsdom/releases/tag/v29.0.1)
[Compare Source](https://github.com/jsdom/jsdom/compare/v29.0.0...v29.0.1)
- Fixed CSS parsing of `'border'`, `'background'`, and their sub-shorthands containing keywords or `var()`. ([@​asamuzaK](https://github.com/asamuzaK))
- Fixed `getComputedStyle()` to return a more functional `CSSStyleDeclaration` object, including indexed access support, which regressed in v29.0.0.
### [`v29.0.0`](https://github.com/jsdom/jsdom/releases/tag/v29.0.0)
[Compare Source](https://github.com/jsdom/jsdom/compare/v28.1.0...v29.0.0)
Breaking changes:
- Node.js v22.13.0+ is now the minimum supported v22 version (was v22.12.0+).
Other changes:
- Overhauled the CSSOM implementation, replacing the [`@acemir/cssom`](https://www.npmjs.com/package/@acemir/cssom) and [`cssstyle`](https://github.com/jsdom/cssstyle) dependencies with fresh internal implementations built on webidl2js wrappers and the [`css-tree`](https://www.npmjs.com/package/css-tree) parser. Serialization, parsing, and API behavior is improved in various ways, especially around edge cases.
- Added `CSSCounterStyleRule` and `CSSNamespaceRule` to jsdom `Window`s.
- Added `cssMediaRule.matches` and `cssSupportsRule.matches` getters.
- Added proper media query parsing in `MediaList`, using `css-tree` instead of naive comma-splitting. Invalid queries become `"not all"` per spec.
- Added `cssKeyframeRule.keyText` getter/setter validation.
- Added `cssStyleRule.selectorText` setter validation: invalid selectors are now rejected.
- Added `styleSheet.ownerNode`, `styleSheet.href`, and `styleSheet.title`.
- Added bad port blocking per the [fetch specification](https://fetch.spec.whatwg.org/#bad-port), preventing fetches to commonly-abused ports.
- Improved `Document` initialization performance by lazily initializing the CSS selector engine, avoiding \~0.5 ms of overhead per `Document`. ([@​thypon](https://github.com/thypon))
- Fixed a memory leak when stylesheets were removed from the document.
- Fixed `CSSStyleDeclaration` modifications to properly trigger custom element reactions.
- Fixed nested `@media` rule parsing.
- Fixed `CSSStyleSheet`'s "disallow modification" flag not being checked in all mutation methods.
- Fixed `XMLHttpRequest`'s `response` getter returning parsed JSON during the `LOADING` state instead of `null`.
- Fixed `getComputedStyle()` crashing in XHTML documents when stylesheets contained at-rules such as `@page` or `@font-face`.
- Fixed a potential hang in synchronous `XMLHttpRequest` caused by a race condition with the worker thread's idle timeout.
### [`v28.1.0`](https://github.com/jsdom/jsdom/releases/tag/v28.1.0)
[Compare Source](https://github.com/jsdom/jsdom/compare/v28.0.0...v28.1.0)
- Added `blob.text()`, `blob.arrayBuffer()`, and `blob.bytes()` methods.
- Improved `getComputedStyle()` to account for CSS specificity when multiple rules apply. ([@​asamuzaK](https://github.com/asamuzaK))
- Improved synchronous `XMLHttpRequest` performance by using a persistent worker thread, avoiding \~400ms of setup overhead on every synchronous request after the first one.
- Improved performance of `node.getRootNode()`, `node.isConnected`, and `event.dispatchEvent()` by caching the root node of document-connected trees.
- Fixed `getComputedStyle()` to correctly handle `!important` priority. ([@​asamuzaK](https://github.com/asamuzaK))
- Fixed `document.getElementById()` to return the first element in tree order when multiple elements share the same ID.
- Fixed `<svg>` elements to no longer incorrectly proxy event handlers to the `Window`.
- Fixed `FileReader` event timing and `fileReader.result` state to more closely follow the spec.
- Fixed a potential hang when synchronous `XMLHttpRequest` encountered dispatch errors.
- Fixed compatibility with environments where Node.js's built-in `fetch()` has been used before importing jsdom, by working around undici v6/v7 incompatibilities.
### [`v28.0.0`](https://github.com/jsdom/jsdom/releases/tag/v28.0.0)
[Compare Source](https://github.com/jsdom/jsdom/compare/v27.4.0...v28.0.0)
- Overhauled resource loading customization. See [the new README](https://github.com/jsdom/jsdom/blob/2b65c6a80af2c899e32933c5e0cb842164852149/README.md#loading-subresources) for details on the new API.
- Added MIME type sniffing to `<iframe>` and `<frame>` loads.
- Regression: `WebSocket`s are no longer correctly throttled to one connection per origin. This is a result of the bug at [nodejs/undici#4743](https://github.com/nodejs/undici/issues/4743).
- Fixed decoding of the query components of `<a>` and `<area>` elements in non-UTF-8 documents.
- Fixed `XMLHttpRequest` fetches and `WebSocket` upgrade requests to be interceptable by the new customizable resource loading. (Except synchronous `XMLHttpRequest`s.)
- Fixed the referrer of a document to be set correctly when redirects are involved; it is now the initiating page, not the last hop in the redirect chain.
- Fixed correctness bugs when passing `ArrayBuffer`s or typed arrays to various APIs, where they would not correctly snapshot the data.
- Fixed `require("url").parse()` deprecation warning when using `WebSocket`s.
- Fixed `<iframe>`, `<frame>`, and `<img>` (when `canvas` is installed) to fire `load` events, not `error` events, on non-OK HTTP responses.
- Fixed many small issues in `XMLHttpRequest`.
### [`v27.4.0`](https://github.com/jsdom/jsdom/releases/tag/v27.4.0)
[Compare Source](https://github.com/jsdom/jsdom/compare/v27.3.0...v27.4.0)
- Added `TextEncoder` and `TextDecoder`.
- Improved decoding of HTML bytes by using the new [`@exodus/bytes`](https://www.npmjs.com/package/@exodus/bytes) package; it is now much more correct. ([@​ChALkeR](https://github.com/ChALkeR))
- Improved decoding of XML bytes to use UTF-8 more often, instead of sniffing for `<meta charset>` or using the parent frame's encoding.
- Fixed a memory leak when `Range`s were used and then the elements referred to by those ranges were removed.
### [`v27.3.0`](https://github.com/jsdom/jsdom/releases/tag/v27.3.0)
[Compare Source](https://github.com/jsdom/jsdom/compare/v27.2.0...v27.3.0)
- Improved CSS parsing and CSSOM object APIs via updates to [`@acemir/cssom`](https://www.npmjs.com/package/@acemir/cssom). ([@​acemir](https://github.com/acemir))
### [`v27.2.0`](https://github.com/jsdom/jsdom/releases/tag/v27.2.0)
[Compare Source](https://github.com/jsdom/jsdom/compare/v27.1.0...v27.2.0)
- Added `CSSGroupingRule`, `CSSNestedDeclarations`, `CSSConditionRule`, `CSSContainerRule`, `CSSScopeRule`, `CSSSupportsRule`, `CSSLayerBlockRule`, and `CSSLayerStatementRule` to jsdom `Window`s. ([@​acemir](https://github.com/acemir))
- Improved CSS parsing and CSSOM object APIs via updates to [`@acemir/cssom`](https://www.npmjs.com/package/@acemir/cssom). ([@​acemir](https://github.com/acemir))
- Fixed `@import`-ed stylesheets to be properly exposed to CSSOM, and not to overwrite the sheet created from the `<link>` or `<style>` element. ([@​acemir](https://github.com/acemir))
### [`v27.1.0`](https://github.com/jsdom/jsdom/releases/tag/v27.1.0)
[Compare Source](https://github.com/jsdom/jsdom/compare/v27.0.1...v27.1.0)
- Improved CSS parsing by switching to [`@acemir/cssom`](https://www.npmjs.com/package/@acemir/cssom), including support for nested selectors, nested declarations, layer statements, and improved at-rule validation. ([@​acemir](https://github.com/acemir))
- Fixed some selector cache invalidation issues where changes to attributes were not being picked up. ([@​asamuzaK](https://github.com/asamuzaK))
- Fixed `package.json` `"engines"` field to reflect the new minimum Node.js versions needed to run jsdom, as noted in the changelog for v27.0.1.
### [`v27.0.1`](https://github.com/jsdom/jsdom/releases/tag/v27.0.1)
[Compare Source](https://github.com/jsdom/jsdom/compare/v27.0.0...v27.0.1)
**This release inadvertently raised the minimum Node.js version from v20.0.0 to v20.19.0+, v22.12.0+, v24.0.0+**. (This happened via a dependency update.) This probably should have been a breaking (major) change, instead of happening in a patch version, since it prevents using earlier Node.js versions.
After further testing, we found that most of our development dependencies also require these versions, and so it's not feasible for the jsdom project to support earlier Node.js versions. (For example, our testing frameworks will not run on them.) If you need to use such earlier versions, or otherwise are working in an environment which gives related errors such as `ERR_REQUIRE_ESM`, then please stick with the v26.1.0 release of jsdom. (Noting, of course, that such versions are unsupported, and we will not respond to bug reports opened against them.)
Subsequent jsdom releases will explicitly require these minimum Node.js versions, and will have CI testing to ensure that the minimum version is not accidentally raised again.
Normal changelog:
- Fixed some regressions in CSS selectors. Most such regression fixes were done in a minor update of a dependency, and thus available for all fresh installs of v27.0.0. However, one related to `class=""` attribute changes is only possible with a new version of jsdom. ([@​asamuzaK](https://github.com/asamuzaK))
### [`v27.0.0`](https://github.com/jsdom/jsdom/releases/tag/v27.0.0)
[Compare Source](https://github.com/jsdom/jsdom/compare/v26.1.0...v27.0.0)
##### Changes since 26.1.0
- Node.js v20 is now the minimum supported version.
- Added a variety of event constructors, even though we do not implement their associated specifications or ever fire them: `BeforeUnloadEvent`, `BlobEvent`, `DeviceMotionEvent` (omitting `requestPermission()`), `DeviceOrientationEvent` (omitting `requestPermission()`), `PointerEvent`, `PromiseRejectionEvent`, and `TransitionEvent`.
- Added `movementX` and `movementY` to `MouseEvent`. (These are from the [Pointer Lock](https://w3c.github.io/pointerlock/) specification, the rest of which is not implemented.)
- Added `customElements.getName()`. ([@​mash-graz](https://github.com/mash-graz))
- Updated the [virtual console](https://github.com/jsdom/jsdom/blob/ab384d4e381eb6bb99ade4146698d35167b54837/README.md#virtual-consoles):
- `"jsdomError"` events are now documented, with specific `type` properties and other properties that depend on the type.
- `sendTo()` was renamed to `forwardTo()`.
- The `jsdomErrors` option to `forwardTo()` can be used to control which errors are sent to the Node.js console. This replaces the previous `omitJSDOMErrors` boolean option.
- `"jsdomError"`s for failed `XMLHttpRequest` fetches are no longer emitted.
- The values that are printed when forwarding `"jsdomError"`s to the Node.js console are streamlined.
- Switched our CSS selector engine from [`nwsapi`](https://www.npmjs.com/nwsapi) to [`@asamuzakjp/dom-selector`](https://www.npmjs.com/package/@asamuzakjp/dom-selector), closing over 20 selector-related bugs.
- Upgraded [`tough-cookie`](https://www.npmjs.com/package/tough-cookie), which now considers URLs like `http://localhost/` to be secure contexts (per [the spec](https://w3c.github.io/webappsec-secure-contexts/#is-origin-trustworthy)), and thus will return `Secure`-flagged cookies for such URLs. ([@​colincasey](https://github.com/colincasey))
- Upgraded [`cssstyle`](https://github.com/jsdom/cssstyle), which brings along many improvements and fixes to the `CSSStyleDeclaration` object and its properties.
- Updated the user agent stylesheet to be derived from the HTML Standard, instead of from an old revision of Chromium.
- Changed `element.click()` to fire a `PointerEvent` instead of a `MouseEvent`.
- Changed certain events to be passive by default.
- Changed the `<input>` element's `pattern=""` attribute to use the `v` regular expression flag, instead of `u`.
- Fixed many specification conformance issues with the `Window` object, including named properties and changing various data properties to accessor properties.
- Fixed `document.createEvent()` to accept a more correct set of event names.
- 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 as `HTMLSelectElement` instances.
- Fixed `jsdom.reconfigure({ url })` not updating `document.baseURI` or properties derived from it. (This regressed in v26.1.0.)
- Fixed CSS system colors, as well as the `initial`, `inherit`, and `unset` keywords, to resolve correctly. ([@​asamuzaK](https://github.com/asamuzaK))
- Fixed CSS `display` style resolution. ([@​asamuzaK](https://github.com/asamuzaK))
##### Changes since 27.0.0-beta.3
- Upgraded `cssstyle`, which brings along various CSS parsing fixes.
### [`v26.1.0`](https://github.com/jsdom/jsdom/releases/tag/v26.1.0)
[Compare Source](https://github.com/jsdom/jsdom/compare/v26.0.0...v26.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` and `SVGAnimatedRect`, including support in the reflection layer.
- Added the `SVGSVGElement` `createSVGRect()` method, and the `SVGRect` type (which is distinct from `DOMRect`.)
- 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 of `multipart/form-data` serialization. No functional changes are expected.
- Various performance improvements, caches, microoptimizations, and deferred object creation.
### [`v26.0.0`](https://github.com/jsdom/jsdom/releases/tag/v26.0.0)
[Compare Source](https://github.com/jsdom/jsdom/compare/v25.0.1...v26.0.0)
Breaking change: [`canvas`](https://www.npmjs.com/package/canvas) peer dependency requirement has been upgraded from v2 to v3. ([@​sebastianwachter](https://github.com/sebastianwachter))
Other changes:
- Added `AbortSignal.any()`. ([@​jdbevan](https://github.com/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](https://github.com/hesxenon))
- Updated `whatwg-url`, adding support for `URL.parse()`.
- Updated `cssstyle` and `rrweb-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.
### [`v25.0.1`](https://github.com/jsdom/jsdom/releases/tag/v25.0.1)
[Compare Source](https://github.com/jsdom/jsdom/compare/v25.0.0...v25.0.1)
- Updated dependencies, notably `tough-cookie`, which no longer prints a deprecation warning.
### [`v25.0.0`](https://github.com/jsdom/jsdom/releases/tag/v25.0.0)
[Compare Source](https://github.com/jsdom/jsdom/compare/v24.1.3...v25.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.
### [`v24.1.3`](https://github.com/jsdom/jsdom/releases/tag/v24.1.3)
[Compare Source](https://github.com/jsdom/jsdom/compare/v24.1.2...v24.1.3)
- Fixed calls to `postMessage()` that were done as a bare property (i.e., `postMessage()` instead of `window.postMessage()`).
### [`v24.1.2`](https://github.com/jsdom/jsdom/releases/tag/v24.1.2)
[Compare Source](https://github.com/jsdom/jsdom/compare/v24.1.1...v24.1.2)
- Fixed an issue with the `in` operator applied to `EventTarget` methods, e.g. `'addEventListener' in window`, which only appeared in Node.js ≥22.5.0. ([@​legendecas](https://github.com/legendecas))
- Fixed the events fired by `blur()`: it no longer fires `focus` and `focusin` on the `Document`, and `blur` and `focusout` no longer have their `relatedTarget` property set. ([@​asamuzaK](https://github.com/asamuzaK))
### [`v24.1.1`](https://github.com/jsdom/jsdom/releases/tag/v24.1.1)
[Compare Source](https://github.com/jsdom/jsdom/compare/v24.1.0...v24.1.1)
- Fixed selection methods to trigger the `selectionchange` event on the `Document` object. ([@​piotr-oles](https://github.com/piotr-oles))
### [`v24.1.0`](https://github.com/jsdom/jsdom/releases/tag/v24.1.0)
[Compare Source](https://github.com/jsdom/jsdom/compare/v24.0.0...v24.1.0)
- Added the `getSetCookie()` method to the `Headers` class. ([@​ushiboy](https://github.com/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.
### [`v24.0.0`](https://github.com/jsdom/jsdom/releases/tag/v24.0.0)
[Compare Source](https://github.com/jsdom/jsdom/compare/v23.2.0...v24.0.0)
This release reverts our selector engine back to [`nwsapi`](https://www.npmjs.com/nwsapi). As discussed in [#​3659](https://github.com/jsdom/jsdom/issues/3659), the performance regressions from [`@asamuzakjp/dom-selector`](https://www.npmjs.com/package/@asamuzakjp/dom-selector) turned out to be higher than anticipated. In the future, we can revisit `@asamuzakjp/dom-selector` after it reaches `nwsapi`'s performance on the [two real-world benchmarks provided by the community](https://github.com/jsdom/jsdom/issues/3659#issuecomment-1890852609).
Since reverting to `nwsapi` causes several functionality regressions, e.g. removing `:has()` support, we've decided to make this a major version.
Additionally:
- Small fixes to edge-case behavior of the following properties: `input.maxLength`, `input.minLength`, `input.size`, `progress.max`, `tableCell.colSpan`, `tableCell.rowSpan`, `tableCol.span`, `textArea.cols`, `textArea.maxLength`, `textArea.minLength`, `textArea.rows`.
### [`v23.2.0`](https://github.com/jsdom/jsdom/releases/tag/v23.2.0)
[Compare Source](https://github.com/jsdom/jsdom/compare/v23.1.0...v23.2.0)
This release switches our CSS selector engine from [`nwsapi`](https://www.npmjs.com/nwsapi) to [`@asamuzakjp/dom-selector`](https://www.npmjs.com/package/@asamuzakjp/dom-selector). The new engine is more actively maintained, and supports many new selectors: see [the package's documentation](https://github.com/asamuzaK/domSelector#supported-css-selectors) for the full list. It also works better with shadow trees.
There is a potential of a performance regression due to this change. In our stress test benchmark, which runs most of [these 273 selectors](https://github.com/jsdom/jsdom/blob/908f27d4e348502a9068f0b335a8518d050ef872/benchmark/selectors/sizzle-speed/selectors.large.css) against [this 128 KiB document](https://github.com/jsdom/jsdom/blob/908f27d4e348502a9068f0b335a8518d050ef872/benchmark/selectors/sizzle-speed/selector.html), the new engine completes the benchmark only 0.25x as fast. However, we're hopeful that in more moderate usage this will not be a significant issue. Any help speeding up `@asamuzakjp/dom-selector` is appreciated, and feel free to open an issue if this has had a significant impact on your project.
### [`v23.1.0`](https://github.com/jsdom/jsdom/releases/tag/v23.1.0)
[Compare Source](https://github.com/jsdom/jsdom/compare/v23.0.1...v23.1.0)
- Added an initial implementation of `ElementInternals`, including the `shadowRoot` getter and the string-valued ARIA properties. ([@​zjffun](https://github.com/zjffun))
- Added the string-valued ARIA attribute-reflecting properties to `Element`.
- Fixed `history.pushState()` and `history.replaceState()` to follow the latest specification, notably with regards to how they handle empty string inputs and what new URLs are possible.
- Fixed the `input.valueAsANumber` setter to handle `NaN` correctly. ([@​alexandertrefz](https://github.com/alexandertrefz))
- Updated various dependencies, including `cssstyle` which contains several bug fixes.
### [`v23.0.1`](https://github.com/jsdom/jsdom/releases/tag/v23.0.1)
[Compare Source](https://github.com/jsdom/jsdom/compare/v23.0.0...v23.0.1)
- Fixed the incorrect `canvas` peer dependency introduced in v23.0.0.
### [`v23.0.0`](https://github.com/jsdom/jsdom/releases/tag/v23.0.0)
[Compare Source](https://github.com/jsdom/jsdom/compare/v22.1.0...v23.0.0)
- Node.js v18 is now the minimum supported version.
- Updated various dependencies, including `whatwg-url` which integrates various additions to the `URL` and `URLSearchParams` objects.
</details>
---
### Configuration
📅 **Schedule**: (UTC)
- Branch creation
- At any time (no schedule defined)
- Automerge
- At any time (no schedule defined)
🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.
♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 **Ignore**: Close this MR and you won't be reminded about this update again.
---
- [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box
---
This MR has been generated by [Mend Renovate CLI](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0NC4xMzIuNiIsInVwZGF0ZWRJblZlciI6IjQ0LjEzMi42IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
This MR contains the following updates:
^22.0.0→^30.0.0Release Notes
jsdom/jsdom (jsdom)
v30.1.2Compare Source
initialreset. (@scttcper)getComputedStyle()returning stale results after editing stylesheet declarations, selectors, or media queries, including in imported stylesheets. (@trooney):focus,:focus-visible,:focus-within, and selectors containing them after focus changes, including inside focus and blur listeners. (@asamuzaK)element.focus()incorrectly focusing elements hidden by 'display', including through shadow hosts and slots, and elements excluded by shadow DOM slot assignment. (@asamuzaK)getComputedStyle()throwing for elements without inline-style support, including XML and MathML elements. (@asamuzaK)window.close().MutationObserverinstances retaining bookkeeping for garbage-collected nodes. (@scttcper)select.selectedOptionscollections becoming stale after selection changes and form resets.color-mix()expressions, including exceptions during color resolution. (@asamuzaK)element.matches()andelement.closest()failing to match SVG elements such as<foreignObject>and<linearGradient>, which regressed in@asamuzakjp/dom-selectorv9.0.3. (@asamuzaK):nth-child(n+B)and:nth-last-child(n+B)matching inelement.matches()and stylesheet rules. (@asamuzaK)v30.1.1Compare Source
blurandfocusoutevents and incorrectevent.relatedTargetvalues when focusing an element after removing the previously focused element, which regressed in v30.1.0. (@asamuzaK)document.documentElement.focus(). (@asamuzaK)blurlisteners becoming active, and text selections made by focus and blur listeners being overwritten. (@asamuzaK)element.focus()incorrectly focusing disabled form controls and<input type="hidden">elements withtabindex="". (@scttcper)style.setProperty()calls changing existing!importantpriorities, serialized styles, or mutation records. (@FedgeNo)!importanthandling when updating CSS longhands after shorthands, using variables or CSS-wide keywords, and assigning style properties directly. (@FedgeNo)<noscript>parsing withincludeNodeLocations: trueor inside frames to honor therunScriptsoption.storageQuotaoption being ignored by frames.charsetparameters in<meta>elements, and encoding detection incorrectly using incomplete<meta>tags. (@FedgeNo)constructor,toString,__proto__, or"null", and incorrect reuse of namespace prefixes declared on sibling elements.element.innerHTMLandelement.outerHTMLin XML documents to reject invalid characters in attribute values and avoid stack overflows on large strings.:lang(),:nth-child(... of ...)after mutations, and:has()with duplicate IDs or nested logical pseudo-classes. (@asamuzaK)v30.1.0Compare Source
jsdom is feeling the AGI!
This release is dedicated to @scttcper, who unleashed @codex upon jsdom and found tons of performance improvements. Along the way, he found and fixed many correctness issues as well.
We really appreciate his thoughtful MRs, which did a great job following the project's contribution guidelines, and were clearly human-curated, with their MR descriptions edited to be brief and respectful of the maintainers' time.
Thanks to @scttcper, as well as all the other contributors of this release (most of whom were AI-assisted).
document, such asdocument.myFormfor<form name="myForm">. (@vojtisprime11)QuotaExceededError, including its use for storage quota errors and oversizedcrypto.getRandomValues()requests.getComputedStyle(), style changes, and CSS serialization. (@scttcper, @jhult)<select>elements and radio button groups. (@scttcper)window.close()to preserve access to the document and its DOM through retained references.element.querySelectorAll()returning no matches when the first part of the selector matches the element itself, which regressed in v30.0.0. (@asamuzaK)data-state="",title="", and other case-sensitive values. (@asamuzaK)document.querySelector()failing to find a matching element when an earlier element has the same ID but does not match the rest of the selector. (@vojtisprime11):focusmatching in shadow trees. (@asamuzaK)document.replaceChildren()calls, invalid document element and doctype placements, and mutations duringelement.replaceWith().window.close()or iframe removal, and prevented new scripts, resource loads, timers, and animation frames from starting in destroyed documents. (@scttcper)requestInterceptor()callbacks, and when reusing anXMLHttpRequestafter aborting it.JSDOM.fromURL()potentially hanging when response handling throws and response stream cleanup does not finish.getComputedStyle()anddocument.styleSheetsusing the wrong stylesheet order after inserting or updating<style>elements.getComputedStyle()ignoring nested@importand@mediarules in imported stylesheets, and returning stale results after imports finish loading.getComputedStyle()calls changing case-sensitive background URLs, and inconsistent resolution of border shorthands containing system colors. (@scttcper)16px, which regressed in v30.0.0. (@Alberto-BaseNet)getComputedStyle()to resolve'font-weight'keywords to numeric values. (@tianrking)getComputedStyle()to convert lengths to pixels inside CSS math functions containing percentages, and to resolve percentages in'font-size'math functions. (@soroushm)min()andmax()containing nestedcalc(), which regressed in v30.0.0. (@asamuzaK)'grid-template-columns'values containing both100pxandcalc(). (@rome-xi)'background'and'border'shorthands with adjacent components, such asurl(a.png)no-repeat, including a crash when parsing inline styles. Also fixed handling of invalid shorthand assignments and escaped or unusual characters in CSS declarations. (@asamuzaK)'flex'shorthands, such as35 1 0, and rejection of negative'flex-basis'lengths and percentages. (@asamuzaK)RangeandSelectionhandling of CDATA sections, including boundary offsets and range cloning, extraction, deletion, insertion, and stringification. (@scttcper)text.normalize()incorrectly removing the text node or merging its siblings. (@scttcper)window, and incorrect named access from empty or namespacedid=""andname=""values. (@scttcper)DOMParserordocument.implementation.createHTMLDocument()appearing as named properties onwindowand being retained in memory. (@Iaotle)storageevents being sent to windows created after the storage change, and ensured surviving recipients still receive events when the source document is destroyed.input.listin detached element trees. (@scttcper)attr.ownerDocumentafter setting an attribute node on an element in another document or adopting its element. (@Kjubikstronk)element.getElementsByTagName()calls using the previous document's case-sensitivity rules after adoption between HTML and XML documents. (@Kjubikstronk)element.tagNamereturning stale casing after adoption between HTML and XML documents.<select>selection updates when moving options, and unintended selection resets when moving a whole<select>or changing unrelated descendants.<input>elements to preserveinput.indeterminate.<script>. (@Kjubikstronk)src="", and handling oftype="",for="", andevent="".document.currentScriptduring nested script execution and scripts in shadow trees.window.event, and default passive listener handling for non-node event targets, and event dispatch when user code modifieswindow.constructor.volumechangeandratechangeevents to fire asynchronously. (@christianaurichzm)NodeIteratortraversal when its filter removes nodes.fileReader.readAsText()to honor the blob's MIME type charset when no supported explicit encoding is supplied.input.valueAsNumberassignments for time and local date/time inputs.<textarea>values to use the numerictextarea.colsvalue.document.readyStateto be"complete"for documents created withdocument.implementation.createDocument()anddocument.implementation.createHTMLDocument().element.translatefor emptytranslate=""values and elements without a parent.node.lookupNamespaceURI()for thexmlandxmlnsprefixes. (@vojtisprime11)<base>elements to ignoredata:andjavascript:URLs. (@vojtisprime11)svgElement.viewportElementinside<symbol>elements.blobEvent.timecodeto beNaN.CSS.v30.0.1Compare Source
getComputedStyle()withcalc()and other functions throwing an exception, which regressed in v30.0.0. (@asamuzaK)v30.0.0Compare Source
Breaking changes:
^22.22.2 || ^24.15.0 || >=26.0.0.Other changes:
CSS.escape()andCSS.supports()functions. (@asamuzaK)'background-position-x'and'background-position-y'CSS properties. (@olagokemills)getComputedStyle()to convert length values into pixels. (@asamuzaK)getPropertyValue(). (@asamuzaK)document.evaluate()(@dokson)v29.1.1Compare Source
'border-radius'computed style serialization. (@asamuzaK)'background-origin'and'background-clip'CSS properties. (@asamuzaK)getComputedStyle(), before the cache warms up. (@asamuzaK)v29.1.0Compare Source
getComputedStyle()sometimes returning outdated results after CSS was modified. (@asamuzaK)v29.0.2Compare Source
getComputedStyle(). Computed value rules are now applied across a broader set of properties, and include fixes related to inheritance, defaulting keywords, custom properties, and color-related values such ascurrentcolorand system colors. (@asamuzaK)'background' and'border'shorthand parsing. (@asamuzaK)v29.0.1Compare Source
'border','background', and their sub-shorthands containing keywords orvar(). (@asamuzaK)getComputedStyle()to return a more functionalCSSStyleDeclarationobject, including indexed access support, which regressed in v29.0.0.v29.0.0Compare Source
Breaking changes:
Other changes:
@acemir/cssomandcssstyledependencies with fresh internal implementations built on webidl2js wrappers and thecss-treeparser. Serialization, parsing, and API behavior is improved in various ways, especially around edge cases.CSSCounterStyleRuleandCSSNamespaceRuleto jsdomWindows.cssMediaRule.matchesandcssSupportsRule.matchesgetters.MediaList, usingcss-treeinstead of naive comma-splitting. Invalid queries become"not all"per spec.cssKeyframeRule.keyTextgetter/setter validation.cssStyleRule.selectorTextsetter validation: invalid selectors are now rejected.styleSheet.ownerNode,styleSheet.href, andstyleSheet.title.Documentinitialization performance by lazily initializing the CSS selector engine, avoiding ~0.5 ms of overhead perDocument. (@thypon)CSSStyleDeclarationmodifications to properly trigger custom element reactions.@mediarule parsing.CSSStyleSheet's "disallow modification" flag not being checked in all mutation methods.XMLHttpRequest'sresponsegetter returning parsed JSON during theLOADINGstate instead ofnull.getComputedStyle()crashing in XHTML documents when stylesheets contained at-rules such as@pageor@font-face.XMLHttpRequestcaused by a race condition with the worker thread's idle timeout.v28.1.0Compare Source
blob.text(),blob.arrayBuffer(), andblob.bytes()methods.getComputedStyle()to account for CSS specificity when multiple rules apply. (@asamuzaK)XMLHttpRequestperformance by using a persistent worker thread, avoiding ~400ms of setup overhead on every synchronous request after the first one.node.getRootNode(),node.isConnected, andevent.dispatchEvent()by caching the root node of document-connected trees.getComputedStyle()to correctly handle!importantpriority. (@asamuzaK)document.getElementById()to return the first element in tree order when multiple elements share the same ID.<svg>elements to no longer incorrectly proxy event handlers to theWindow.FileReaderevent timing andfileReader.resultstate to more closely follow the spec.XMLHttpRequestencountered dispatch errors.fetch()has been used before importing jsdom, by working around undici v6/v7 incompatibilities.v28.0.0Compare Source
<iframe>and<frame>loads.WebSockets are no longer correctly throttled to one connection per origin. This is a result of the bug at nodejs/undici#4743.<a>and<area>elements in non-UTF-8 documents.XMLHttpRequestfetches andWebSocketupgrade requests to be interceptable by the new customizable resource loading. (Except synchronousXMLHttpRequests.)ArrayBuffers or typed arrays to various APIs, where they would not correctly snapshot the data.require("url").parse()deprecation warning when usingWebSockets.<iframe>,<frame>, and<img>(whencanvasis installed) to fireloadevents, noterrorevents, on non-OK HTTP responses.XMLHttpRequest.v27.4.0Compare Source
TextEncoderandTextDecoder.@exodus/bytespackage; it is now much more correct. (@ChALkeR)<meta charset>or using the parent frame's encoding.Ranges were used and then the elements referred to by those ranges were removed.v27.3.0Compare Source
@acemir/cssom. (@acemir)v27.2.0Compare Source
CSSGroupingRule,CSSNestedDeclarations,CSSConditionRule,CSSContainerRule,CSSScopeRule,CSSSupportsRule,CSSLayerBlockRule, andCSSLayerStatementRuleto jsdomWindows. (@acemir)@acemir/cssom. (@acemir)@import-ed stylesheets to be properly exposed to CSSOM, and not to overwrite the sheet created from the<link>or<style>element. (@acemir)v27.1.0Compare Source
@acemir/cssom, including support for nested selectors, nested declarations, layer statements, and improved at-rule validation. (@acemir)package.json"engines"field to reflect the new minimum Node.js versions needed to run jsdom, as noted in the changelog for v27.0.1.v27.0.1Compare Source
This release inadvertently raised the minimum Node.js version from v20.0.0 to v20.19.0+, v22.12.0+, v24.0.0+. (This happened via a dependency update.) This probably should have been a breaking (major) change, instead of happening in a patch version, since it prevents using earlier Node.js versions.
After further testing, we found that most of our development dependencies also require these versions, and so it's not feasible for the jsdom project to support earlier Node.js versions. (For example, our testing frameworks will not run on them.) If you need to use such earlier versions, or otherwise are working in an environment which gives related errors such as
ERR_REQUIRE_ESM, then please stick with the v26.1.0 release of jsdom. (Noting, of course, that such versions are unsupported, and we will not respond to bug reports opened against them.)Subsequent jsdom releases will explicitly require these minimum Node.js versions, and will have CI testing to ensure that the minimum version is not accidentally raised again.
Normal changelog:
class=""attribute changes is only possible with a new version of jsdom. (@asamuzaK)v27.0.0Compare Source
Changes since 26.1.0
BeforeUnloadEvent,BlobEvent,DeviceMotionEvent(omittingrequestPermission()),DeviceOrientationEvent(omittingrequestPermission()),PointerEvent,PromiseRejectionEvent, andTransitionEvent.movementXandmovementYtoMouseEvent. (These are from the Pointer Lock specification, the rest of which is not implemented.)customElements.getName(). (@mash-graz)"jsdomError"events are now documented, with specifictypeproperties and other properties that depend on the type.sendTo()was renamed toforwardTo().jsdomErrorsoption toforwardTo()can be used to control which errors are sent to the Node.js console. This replaces the previousomitJSDOMErrorsboolean option."jsdomError"s for failedXMLHttpRequestfetches are no longer emitted."jsdomError"s to the Node.js console are streamlined.nwsapito@asamuzakjp/dom-selector, closing over 20 selector-related bugs.tough-cookie, which now considers URLs likehttp://localhost/to be secure contexts (per the spec), and thus will returnSecure-flagged cookies for such URLs. (@colincasey)cssstyle, which brings along many improvements and fixes to theCSSStyleDeclarationobject and its properties.element.click()to fire aPointerEventinstead of aMouseEvent.<input>element'spattern=""attribute to use thevregular expression flag, instead ofu.Windowobject, including named properties and changing various data properties to accessor properties.document.createEvent()to accept a more correct set of event names.ElementInternalsaccessibility getters and setters. (They were introduced in v23.1.0, but due to inadequate test coverage never actually worked.)Object.defineProperty()on certain objects, such asHTMLSelectElementinstances.jsdom.reconfigure({ url })not updatingdocument.baseURIor properties derived from it. (This regressed in v26.1.0.)initial,inherit, andunsetkeywords, to resolve correctly. (@asamuzaK)displaystyle resolution. (@asamuzaK)Changes since 27.0.0-beta.3
cssstyle, which brings along various CSS parsing fixes.v26.1.0Compare Source
<defs>(SVGDefsElement),<desc>(SVGDescElement),<g>(SVGGElement),<metadata>(SVGMetadataElement),<switch>(SVGSwitchElement), and<symbol>(SVGSymbolElement).SVGAnimatedPreserveAspectRatioandSVGAnimatedRect, including support in the reflection layer.SVGSVGElementcreateSVGRect()method, and theSVGRecttype (which is distinct fromDOMRect.)HTMLFormElement.SVGElementviewportElement()method to correctly establish the viewport based on ancestor elements.form-datadependency in favor of our own smaller implementation ofmultipart/form-dataserialization. No functional changes are expected.v26.0.0Compare Source
Breaking change:
canvaspeer dependency requirement has been upgraded from v2 to v3. (@sebastianwachter)Other changes:
AbortSignal.any(). (@jdbevan)ElementInternalslabelsproperty. The form-associated callbacks are not yet supported. (@hesxenon)whatwg-url, adding support forURL.parse().cssstyleandrrweb-cssom, to improve CSS parsing capabilities.nwsapi, improving CSS selector matching.parse5, fixing a bug around<noframes>elements and HTML entity decoding.JSDOM.fromURL()to properly reject the returned promise if the server redirects to an invalid URL, instead of causing an uncaught exception.v25.0.1Compare Source
tough-cookie, which no longer prints a deprecation warning.v25.0.0Compare Source
This major release changes the prototype of a jsdom's
EventTarget.prototypeto point to theObject.prototypeinside the jsdom, instead of pointing to the Node.jsObject.prototype. Thus, the prototype chain ofWindowstays entirely within the jsdom, never crossing over into the Node.js realm.This only occurs when
runScriptsis set to non-default values of"dangerously"or"outside-only", as with the default value, there is no separateObject.prototypeinside the jsdom.This will likely not impact many programs, but could cause some changes in
instanceofbehavior, and so out of an abundance of caution, we're releasing it as a new major version.v24.1.3Compare Source
postMessage()that were done as a bare property (i.e.,postMessage()instead ofwindow.postMessage()).v24.1.2Compare Source
inoperator applied toEventTargetmethods, e.g.'addEventListener' in window, which only appeared in Node.js ≥22.5.0. (@legendecas)blur(): it no longer firesfocusandfocusinon theDocument, andblurandfocusoutno longer have theirrelatedTargetproperty set. (@asamuzaK)v24.1.1Compare Source
selectionchangeevent on theDocumentobject. (@piotr-oles)v24.1.0Compare Source
getSetCookie()method to theHeadersclass. (@ushiboy)Object.prototype, like"constructor"or"toString".rweb-cssom, which can now parse additional CSS constructs.v24.0.0Compare Source
This release reverts our selector engine back to
nwsapi. As discussed in #3659, the performance regressions from@asamuzakjp/dom-selectorturned out to be higher than anticipated. In the future, we can revisit@asamuzakjp/dom-selectorafter it reachesnwsapi's performance on the two real-world benchmarks provided by the community.Since reverting to
nwsapicauses several functionality regressions, e.g. removing:has()support, we've decided to make this a major version.Additionally:
input.maxLength,input.minLength,input.size,progress.max,tableCell.colSpan,tableCell.rowSpan,tableCol.span,textArea.cols,textArea.maxLength,textArea.minLength,textArea.rows.v23.2.0Compare Source
This release switches our CSS selector engine from
nwsapito@asamuzakjp/dom-selector. The new engine is more actively maintained, and supports many new selectors: see the package's documentation for the full list. It also works better with shadow trees.There is a potential of a performance regression due to this change. In our stress test benchmark, which runs most of these 273 selectors against this 128 KiB document, the new engine completes the benchmark only 0.25x as fast. However, we're hopeful that in more moderate usage this will not be a significant issue. Any help speeding up
@asamuzakjp/dom-selectoris appreciated, and feel free to open an issue if this has had a significant impact on your project.v23.1.0Compare Source
ElementInternals, including theshadowRootgetter and the string-valued ARIA properties. (@zjffun)Element.history.pushState()andhistory.replaceState()to follow the latest specification, notably with regards to how they handle empty string inputs and what new URLs are possible.input.valueAsANumbersetter to handleNaNcorrectly. (@alexandertrefz)cssstylewhich contains several bug fixes.v23.0.1Compare Source
canvaspeer dependency introduced in v23.0.0.v23.0.0Compare Source
whatwg-urlwhich integrates various additions to theURLandURLSearchParamsobjects.Configuration
📅 Schedule: (UTC)
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this MR and you won't be reminded about this update again.
This MR has been generated by Mend Renovate CLI.
mentioned in issue #56
added 10 commits
mainaa69eb85- Merge remote-tracking branch 'origin/main' into renovate/jsdom-30.xCompare with previous version
added 1 commit
a37f6ad8- ci: run jsdom tests on supported Node runtimeCompare with previous version
mentioned in commit
54d4d95426Preserved GitLab !171 history: source attribution, exact timestamps, discussion grouping and review positions. Historical diff snapshots: 4; visible source notes: 4.
gitlab-35-mergerequest-171.md (SHA-256
ef32c900a96069812b5e5815e9949643706438738a06d9b53750209dacad4207)gitlab-35-mergerequest-171.json (SHA-256
9b13caece0593f8fca6269d2df264ceda0ae189cd28c1dcdd94010b997b75c37)Old CI job execution and reports are omitted. Original source files and rollback backups remain protected.