Skip to content

Update dependency jsdom to v31 - #1903

Merged
nedtwigg merged 2 commits into
mainfrom
renovate/jsdom-31.x
Nov 28, 2026
Merged

nedtwigg merged 2 commits into
mainfrom
renovate/jsdom-31.x

Conversation

@renovate

@renovate renovate Bot commented Nov 28, 2026

Copy link
Copy Markdown
Contributor

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
jsdom ^30.0.0 → ^31.0.0 age adoption passing confidence

Release Notes

jsdom/jsdom (jsdom)

v31.0.1

Compare Source

  • Improved performance of computed style reads, selector matching, CSS variable substitution, CSS shorthand updates, and focus handling on pages with many style rules. (@​scttcper)
  • Improved performance when building detached DOM trees and reading node.isConnected. (@​scttcper)
  • Fixed element.tabIndex handling of invalid and out-of-range tabindex="" values to use the element's default instead of returning zero or wrapping. Values with trailing non-digits now use their leading integer, so tabindex="1e2" yields 1 instead of 100. (@​rome-xi)
  • Fixed CSS ident() results containing spaces or leading digits losing their required escaping during serialization and variable substitution. (@​scttcper)
  • Fixed 'max-lines' values combining an integer and auto to serialize with the integer first, such as 3 auto.

v31.0.0

Compare Source

Breaking changes

  • Changed the optional canvas and image decoding backend from canvas to @napi-rs/canvas. Install @napi-rs/canvas v1.0.13 or later in the v1.x series alongside jsdom; installing canvas alone no longer enables this support. The new backend provides prebuilt Skia binaries on supported platforms, and rendering and encoded image bytes can differ. Projects using native canvas objects or custom font registration should follow the canvas migration guidance. Added WebP serialization through canvas.toDataURL() and canvas.toBlob(). Fixed image loading to wait for decoding before firing load, discard obsolete source requests, avoid refetching when dimensions change, and prevent failed images from drawing stale contents. Fixed canvas context and serialization behavior, including unsupported context types, read-only ctx.canvas, image-drawing exceptions, MIME type and quality normalization, and asynchronous null results from canvas.toBlob() for empty canvases or encoding failures. (@​Brooooooklyn)
  • Changed CSS parsing, selector matching, and computed styles to use a new integrated implementation, with substantially expanded support and faster selector queries and repeated style reads. This includes cascade layers, nesting, @scope, custom-property substitution and registration through @property and CSS.registerProperty(), typed attr(), conditional if(), shadow-tree styling with :host, ::slotted(), and ::part(), pseudo-element computed styles, and constructable stylesheets with document.adoptedStyleSheets and shadowRoot.adoptedStyleSheets. Fixed numerous cascade, shorthand, serialization, and default-style issues; computed declarations now stay live across DOM and stylesheet changes. CSS serialization and computed values can differ from previous releases.
  • Changed HTML and XML parsing to pause at blocking scripts until their required resources are ready. The JSDOM constructor, JSDOM.fromURL(), and JSDOM.fromFile() can now return partially parsed documents. Wait for DOMContentLoaded for the finished tree, or the window's load event for load-delaying resources, checking document.readyState first in case the event has already fired. XML syntax errors encountered after asynchronous parsing resumes are reported through the virtual console as "xml-parsing" errors.

Other changes

  • Added window.reportError(), which dispatches an error event and reports uncanceled errors to the virtual console. (@​sarankumar1325)
  • Added element.ariaBrailleLabel and element.ariaBrailleRoleDescription. (@​Kjubikstronk)
  • Fixed page-completion load events to fire only on the window. Use window.addEventListener("load", ...) or window.onload instead of listening on the document.
  • Fixed document.open(), including implicit calls from document.write(), to clear event listeners and handlers from the document, its descendants, and its window when replacing the input stream.
  • Fixed document.write() to process successive writes through the parser's input stream, preserve insertion points across nested scripts, and make completed text immediately visible. Script-created input streams now remain open until document.close().
  • Fixed dynamically inserted scripts to respect script.async = false execution order, use their source text and document from preparation time, and avoid executing after adoption into another document. Scripts parsed through inert fragment APIs no longer execute when subsequently inserted.
  • Fixed unrelated images, stylesheets, and frames being delayed behind scripts, and resource completion events firing before nested stylesheet imports finish. Cyclic imports no longer prevent completion, and <style> elements in shadow trees now fire load events.
  • Fixed window.stop() to cancel pending subresource and XMLHttpRequest requests in descendant frames and suppress completion events for canceled loads, while allowing subsequent requests to proceed.
  • Fixed repeated document.close() calls replaying readiness and load events, and incorrect iframe load events when reopening documents from event handlers.
  • Fixed memory leaks where pending request interceptor promises retained closed windows, introduced in v28.0.0.
  • Fixed focus remaining on elements that become non-focusable after DOM or style changes. Focus now moves asynchronously to the document's viewport, and element.blur() can release it immediately.
  • Fixed document.hasFocus() returning false before an element is focused or during focus transitions within the document, including inside frames.
  • Fixed <template> parsing and template.innerHTML serialization in XML documents, including templates with namespace prefixes. (@​b84330808)
  • Fixed rect.toJSON() and performance.toJSON() to create their result objects in the method's realm instead of the host Node.js realm.

Configuration

📅 Schedule: (in timezone America/Los_Angeles)

  • Branch creation
    • Only on Monday (* * * * 1)
  • Automerge
    • At any time (no schedule defined)

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

Deploying mouseterm with  Cloudflare Pages  Cloudflare Pages

Latest commit: fddc466
Status: ✅  Deploy successful!
Preview URL: https://c7cf47c7.mouseterm.pages.dev
Branch Preview URL: https://renovate-jsdom-31-x.mouseterm.pages.dev

View logs

@argos-ci
argos-ci Bot temporarily deployed to dormouse/preview November 28, 2026 20:11 Inactive

@dormouse-bot dormouse-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Library Tests check is red on this head, with 269 failures across five lib files. Main passes the same workflow. I'm pushing the fix to this branch. Both causes are jsdom 31 behavior changes the tests depend on, not product regressions:

  • Stranded animation frames (Wall.test.tsx, TerminalContext.test.tsx). jsdom 31 added a focus-fixup step: when the focused element goes inert or is removed, it starts its rendering-update setInterval. That interval uses the Node global, which vi.useFakeTimers() replaces. A test that closes a focused menu under fake timers and then calls vi.useRealTimers() leaves the interval on a discarded clock. From then on no requestAnimationFrame in that file's window fires, so every later flushFrame() times out. This caused 258 of Wall's 268 failures and TerminalContext's 8. The fix runs one fake frame before restoring real timers, in the Wall context-exit test and in TerminalContext's afterEach.
  • CSS serialization (SelectionRing, SurfacePaneHeader, WorkspaceSelectionOverlay tests). The new CSS engine reads back 0 0 as 0px 0px, calc(100vw - 24px) as calc(-24px + 100vw), and the animation shorthand with the name last. The components still set the same values, so the fix updates the three expected strings.

jsdom 31 starts its rendering interval for focus fixup on whichever clock is
current; one started under vi.useFakeTimers() never runs after
vi.useRealTimers(), so every later requestAnimationFrame in the file hangs.
Run one fake frame before restoring real timers. Update three assertions
for the new CSS engine's serialization.
@renovate

renovate Bot commented Nov 28, 2026

Copy link
Copy Markdown
Contributor Author

Edited/Blocked Notification

Renovate will not automatically rebase this PR, because it does not recognize the last commit author and assumes somebody else may have edited the PR.

You can manually request rebase by checking the rebase/retry box above.

⚠️ Warning: custom changes will be lost.

@nedtwigg
nedtwigg merged commit b8bee10 into main Nov 28, 2026
19 checks passed
@nedtwigg
nedtwigg deleted the renovate/jsdom-31.x branch November 28, 2026 20:35

This branch was successfully deployed

1 active deployment
dormouse/preview — fddc4667 Deployed Nov 28, 2026 by argos-ci[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants