unstale

npm / happy-dom

happy-dom

What changed in happy-dom 15 to 21, from its official release notes, upgrade guides and advisories. Also covers @happy-dom/global-registrator. Sources checked 2026-11-30.

15 breaking9 security1 deprecations30 new APIs and options11 performance12 behavior and defaults85 fixes and other

See which of these apply to your code, ranked, in your agent:

npx @unstale/cli init

@unstale/cli on npm

happy-dom 216 changes

Breaking changes 2

  • Opaque-origin data: iframes can no longer access their parent or top window.

    21.0.4release notes

  • CSS and IFrame loading are disabled by default to prevent server-side request forgery from untrusted HTML.

    21.0.0release notessecurity advisory

Security 3

  • Fixed a code injection vulnerability in the ESM compiler.

    21.0.4release notes

  • Happy DOM: Incomplete fix for CVE-2026-33943: unsanitized import alias leads to host code execution

    21.0.4security advisory

  • Fixes a security vulnerability where the authorization header was forwarded when redirecting.

    21.0.3release notes

Deprecations 1

  • The settings property disableCSSFileLoading has been deprecated.

    21.0.0release notes

happy-dom 20107 changes

Breaking changes 4

  • Cookies from the current origin are no longer forwarded to the target origin in fetch requests.

    20.8.9release notes

  • Throws an error if the event passed to EventTarget.dispatchEvent() is not of type Event.

    20.8.3release notes

  • The inert attribute now blocks focus interactions.

    20.8.1release notes

  • JavaScript evaluation is disabled by default for security; set enableJavaScriptEvaluation to true to enable it.

    20.0.0release notes

Security 6

  • Fixes a cookie scope forgery vulnerability.

    20.14.6release notessecurity advisory

  • Values pushed or assigned to the adoptedStyleSheet array are validated.

    20.11.8release notes

  • Happy DOM's fetch credentials include uses page-origin cookies instead of target-origin cookies

    20.8.9security advisory

  • Fixes executable-code interpolation in ESM export names that could allow escaping the VM context and accessing process-level functionality in unsafe CommonJS environments.

    20.8.8release notessecurity advisory

  • EventTarget no longer calls arbitrary on* properties.

    20.3.4release notes

  • happy-dom's --disallow-code-generation-from-strings is not sufficient for isolating untrusted JavaScript

    20.0.2security advisory

New APIs and options 17

  • Adds support for the :host pseudo query selector.

    20.13.0release notes

  • Adds support for Animation.

    20.12.0release notes

  • Adds support for AnimationTimeline.

    20.12.0release notes

  • Adds support for DocumentTimeline.

    20.12.0release notes

  • Adds support for Element.animate().

    20.12.0release notes

  • Adds support for KeyframeEffect.

    20.12.0release notes

  • Allows specifying an explicit element type for querySelector results, such as HTMLInputElement.

    20.11.5release notes

  • Adds support for event listener properties on Window, such as Window.onkeydown.

    20.9.0release notes

  • Adds support for hasPointerCapture to Element.

    20.8.0release notes

  • Adds support for releasePointerCapture to Element.

    20.8.0release notes

  • Adds support for setPointerCapture to Element.

    20.8.0release notes

  • Adds support for Window.getScreenDetails().

    20.7.0release notes

  • Adds support for registering globals when importing the package.

    20.6.0release notes

  • Implements the Text.wholeText property.

    20.5.4release notes

  • Adds the which property to KeyboardEvent.

    20.3.3release notes

  • Adds support for CloseEvent, making it available to developers using Happy DOM.

    20.1.0release notes

  • Adds support for WebSocket, making it available to developers using Happy DOM.

    20.1.0release notes

Performance 8

  • The computed style cache is improved, which may improve performance.

    20.14.0release notes

  • Query selector performance is improved by avoiding DOMException construction when it is not needed.

    20.11.1release notes

  • Adds a cache to mitigate the selector parser's performance degradation introduced in v20.6.3.

    20.10.5release notes

  • Adds support for caching compiled EcmaScript module code.

    20.4.0release notes

  • Improves how nodes are destroyed and garbage collected.

    20.4.0release notes

  • Adding and removing tokens is optimized with a Set.

    20.3.2release notes

  • Query selectors use Element.classList.contains() instead of splitting className, improving performance because classList is cached.

    20.2.0release notes

  • Avoids sorting in querySelector() to improve performance.

    20.1.1release notes

Behavior and default changes 9

  • Adds support for kebab-case properties on CSSStyleDeclaration.

    20.12.1release notes

  • Adds support for all Chromium CSS properties to CSSStyleDeclaration.

    20.12.1release notes

  • Adds support for loading image data URLs.

    20.10.0release notes

  • Screen now extends EventTarget.

    20.7.0release notes

  • The query selector parser can handle complex rules.

    20.6.3release notes

  • CSS gradients now support rgba().

    20.6.1release notes

  • HTML/XML encoding and decoding now uses the entities package.

    20.5.2release notes

  • Elements are upgraded to custom elements only when they are in the document, which also improves memory footprint by allowing nodes to be garbage collected before the document is closed.

    20.0.9release notes

  • Workers in @happy-dom/server-renderer now use the frozen intrinsics flag.

    20.0.2release notes

Fixes and other changes 63

  • Character references are preserved in comment data.

    20.14.5release notes

  • End comments at the first comment end tag when it overlaps a comment start tag.

    20.14.4release notes

  • Fixes a regression where not all CSS variables were resolved in getComputedStyle().

    20.14.2release notes

  • Invalidates the computed style cache for the whole subtree.

    20.14.1release notes

  • Fixes getComputedStyle with :host and :host-context selectors.

    20.13.2release notes

  • GetComputedStyle now returns the inherited value when a property is set to inherit.

    20.13.1release notes

  • Custom elements are upgraded when connected to the DOM.

    20.12.2release notes

  • Fixes issue with parsing CSS fallback variables.

    20.12.1release notes

  • Fixes an issue with upgrading custom elements caused by the previous release.

    20.11.15release notes

  • Upgrading an element changes its prototype to the custom element, keeping references to the original element valid.

    20.11.14release notes

  • Event listeners are copied when upgrading a custom element.

    20.11.13release notes

  • Adds a check that a node is still a parent during disconnect.

    20.11.12release notes

  • Returns the default validationMessage for built-in constraint violations.

    20.11.10release notes

  • Ensures an element has been upgraded before invoking its reaction callback.

    20.11.9release notes

  • Document.adoptedStyleSheets and ShadowRoot.adoptedStyleSheets now validate their value.

    20.11.7release notes

  • The CORS check in fetch() now matches origins instead of host and protocol.

    20.11.4release notes

  • document.links now returns a live HTMLCollection.

    20.11.3release notes

  • Copies the labels array to prevent mutation of a cached querySelectorAll result.

    20.11.3release notes

  • Fixes the callback being garbage-collected due to an orphaned WeakRef.

    20.11.2release notes

  • Awaits the NodeJS internal ReadableStream promise during teardown.

    20.10.6release notes

  • A null qualifiedName is coerced to an empty string in createDocument.

    20.10.4release notes

  • Fixes attribute selector matching for hyphenated substrings in CSS selectors.

    20.10.3release notes

  • Replaces implementation of Node.js Console with the common IConsole interface to support the latest version of Bun.

    20.8.7release notes

  • Request.formData() now honors the Content-Type header.

    20.8.6release notes

  • Fixes an error thrown when modifying DOM structure in connectedCallback().

    20.8.5release notes

  • Calling Event.initEvent() resets Event.cancelBubble and Event.defaultPrevented.

    20.8.2release notes

  • CSS escape sequences in attribute selector values are now properly decoded.

    20.7.2release notes

  • Fixes parsing of direct descendant (>) and universal (*) query selectors.

    20.7.1release notes

  • Adds clearImmediate to the Jest environment's global scope.

    20.6.5release notes

  • Invalid input type attributes are normalized to text per the HTML specification.

    20.6.4release notes

  • Fixes query selectors for attributes in XML documents.

    20.6.3release notes

  • Fixes attribute query selectors with quotes inside quoted values.

    20.6.3release notes

  • Resolves a missing export affecting Vue and vue-compat v3.5.

    20.6.2release notes

  • Selectors now support unicode characters per the CSS spec.

    20.6.1release notes

  • Corrects the caption element content model to allow flow content.

    20.5.5release notes

  • Node.replaceWith no longer throws when called without a parent.

    20.5.3release notes

  • Fixed logic to make HTMLInputElement.stepDown() work according to spec.

    20.5.1release notes

  • Fixed logic to make HTMLInputElement.stepUp() work according to spec.

    20.5.1release notes

  • Selection API now accepts Document nodes as valid boundary points.

    20.3.9release notes

  • Fixed the getters for focusNode and focusOffset, which returned incorrect values.

    20.3.8release notes

  • Fixes toggling the open attribute of <details> by clicking a child of <summary>.

    20.3.6release notes

  • Checks whether hostname and pathname are undefined using optional chaining.

    20.3.5release notes

  • Preserves attribute name case in CSS selectors for XML documents.

    20.3.4release notes

  • Implements implicit closing of <p> elements per the HTML spec.

    20.3.4release notes

  • Parses the Cache-Control header max-age value with parseFloat().

    20.3.3release notes

  • Fixes Node.contains() for <select> and <form> elements.

    20.3.3release notes

  • Returns the correct root for detached shadow trees.

    20.3.3release notes

  • Named HTML entities are decoded correctly.

    20.3.2release notes

  • WebSocket URLs can include paths.

    20.3.2release notes

  • Normalizes the format parameter according to the HTML specification.

    20.3.1release notes

  • Handles partial responses.

    20.3.1release notes

  • Fixes caching in querySelector().

    20.1.1release notes

  • Manually set authorization headers are now included in requests; headers are omitted only when automatically set by page context.

    20.0.11release notes

  • Closing a Window now clears event listeners on all nodes to prevent memory leaks.

    20.0.10release notes

  • nextSibling() now works in HTMLSelectElement and HTMLFormElement.

    20.0.8release notes

  • previousSibling() now works in HTMLSelectElement and HTMLFormElement.

    20.0.8release notes

  • Parsing an item without a permitted parent, such as <tr>, is valid inside a <template> element.

    20.0.8release notes

  • Fixes incorrect handling of the >= operator in the media query parser.

    20.0.7release notes

  • Changes the implementation to be spec compliant.

    20.0.6release notes

  • The setter now validates that the value is a Node.

    20.0.5release notes

  • Buttons are added to FormData only if they are the submitter.

    20.0.4release notes

  • CSS variables are now parsed correctly when they appear inside CSS functions.

    20.0.3release notes

  • URL resolution now occurs after checking whether module preloading is enabled, preventing URL errors when a URL cannot be resolved.

    20.0.3release notes

happy-dom 191 changes

Breaking changes 1

  • CommonJS support is removed; the package now requires an ES module-compatible loading approach.

    19.0.0release notes

happy-dom 185 changes

Breaking changes 2

  • Throws an error when trying to close the default context of a browser.

    18.0.0release notes

  • Happy DOM types are stricter, allowing projects with a strict configuration to set skipLibCheck to false; some types have changed.

    18.0.0release notes

New APIs and options 3

  • Adds support for checking whether a browser is closed.

    18.0.0release notes

  • Adds support for clearing cookies in a cookie container.

    18.0.0release notes

  • Adds support for closing a virtual console printer.

    18.0.0release notes

happy-dom 1713 changes

Breaking changes 1

  • Invalid attributes are disallowed from being set.

    17.0.0release notes

New APIs and options 4

  • Adds support for credentials when fetching styles and scripts.

    17.0.0release notes

  • Adds support for tracing never ending tasks when using waitUntilComplete().

    17.0.0release notes

  • Adds support for the blocking property.

    17.0.0release notes

  • Adds support for referrerPolicy when fetching styles and scripts.

    17.0.0release notes

Performance 1

Behavior and default changes 2

  • JavaScript files can use import and export statements.

    17.0.0release notes

  • Failed requests are output to the console.

    17.0.0release notes

Fixes and other changes 5

  • The fetch interceptor is called in virtual server requests.

    17.0.0release notes

  • Supports preloading fetch, stylesheet, script and module resources.

    17.0.0release notes

  • Adds support for the supports() method.

    17.0.0release notes

  • Adds support for Request.mode.

    17.0.0release notes

  • Children in a ShadowRoot of a custom element upgraded from a HTMLElement are considered connected to the DOM.

    17.0.0release notes

happy-dom 1610 changes

Breaking changes 1

  • Parsing and serialization were refactored; serialized output may differ from v15 and may break tests.

    16.0.0release notes

Performance 1

  • Parsing through document.write() is faster because elements are added directly to the document during parsing.

    16.0.0release notes

Behavior and default changes 1

Fixes and other changes 7

  • Parsing now handles attribute names containing [ or ].

    16.0.0release notes

  • Comments containing HTML tags are now handled correctly.

    16.0.0release notes

  • HTML entities are now handled correctly when parsing and serializing.

    16.0.0release notes

  • Handling of <html>, <head> and <body> during parsing was fixed.

    16.0.0release notes

  • Scripts load asynchronously when defer is set or type is module.

    16.0.0release notes

  • Parsing now handles rules for table elements.

    16.0.0release notes

  • Namespace handling in XMLSerializer was fixed.

    16.0.0release notes

happy-dom 1521 changes

Breaking changes 4

  • No longer includes text data inside child elements.

    15.0.0release notes

  • No longer cancels default behavior when cancelable is not sent as an option to EventTarget.dispatchEvent().

    15.0.0release notes

  • Official support for Node.js 16.x and 17.x is dropped.

    15.0.0release notes

  • Renames TimeRange to TimeRanges.

    15.0.0release notes

New APIs and options 6

Performance 1

  • Improves performance for some pseudo query selectors.

    15.0.0release notes

Fixes and other changes 10

  • Cloning an Attr now clones its internal values.

    15.0.0release notes

  • Updates now trigger listeners for the style attribute.

    15.0.0release notes

  • Collections returned by the listed methods are now live.

    15.0.0release notes

  • Adds support for the list property.

    15.0.0release notes

  • Support now includes all methods and properties of the HTMLMediaElement interface.

    15.0.0release notes

  • Adds support for assign(), assignedNodes(), assignedElements(), and the slotchange event.

    15.0.0release notes

  • Improves support for ShadowRoot, adding clonable, serializable, and slotAssignment.

    15.0.0release notes

  • Resolves when navigating to URLs such as javascript or about:blank.

    15.0.0release notes

  • Corrects parent and top values in some scenarios.

    15.0.0release notes

  • Corrects escaping of attributes and text data, including for features such as innerHTML.

    15.0.0release notes