Packages

jsdom

31.0.1 · 13 Nov 2026MIT166.8M / weekRepositoryHomepagenpmAtom feed

Upgrading jsdom From 30.1.3 to 31.0.1

2 releases in betweenevery note read

  1. 30.1.3yours
  2. 31.0.0major
  3. 31.0.1target

Start here

Before you upgrade

Tick each one off as you go
  • Breaking31.0.0
  • Breaking31.0.0
  • Breaking31.0.0

Release by release

  1. 31.0.1

    13 Nov 20263 fixes
    • Fixed

      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.

    • Fixed

      Fixed CSS ident() results containing spaces or leading digits losing their required escaping during serialization and variable substitution.

    • Fixed

      Fixed 'max-lines' values combining an integer and auto to serialize with the integer first, such as 3 auto.

  2. 31.0.0

    Migration needed5 Nov 20262 new · 12 fixes
    • Breaking

      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.

    • Breaking

      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.

    • Breaking

      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.

    • New

      Added window.reportError(), which dispatches an error event and reports uncanceled errors to the virtual console.

2 other lines we could not sort, mostly version bumps
  • Improved performance of computed style reads, selector matching, CSS variable substitution, CSS shorthand updates, and focus handling on pages with many style rules.

    31.0.1
  • Improved performance when building detached DOM trees and reading node.isConnected.

    31.0.1

A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.