---
title: "dompurify 3.5.1 Breaking Changes on npm | Since.dev"
description: "What each dompurify release removed, renamed or changed: 21 breaking changes in 11 versions on npm, each with its source."
canonical_url: https://since.dev/packages/npm/dompurify
last_updated: 2026-12-04
---

# dompurify breaking changes

dompurify 3.5.1 (December 2, 2026) is its newest release with breaking changes, 3 of them. The first: Behavior changed sanitize. Every breaking API change we have recorded in dompurify on npm: 21 breaking changes in 11 versions. Below, its 11 versions with breaking changes, newest first, removals and renames first, each with its source.

Updated December 4, 2026

Latest version `3.5.1`, released December 2, 2026. [Source repository](https://github.com/cure53/DOMPurify)

Packages on npm run on Node.js. [Node.js end of life dates](https://since.dev/calendar/nodejs.md).

- From [2.0.0](#v-2-0-0) to [3.5.1](#v-3-5-1): 20 breaking changes in 10 versions.

## dompurify 3.5.1 breaking changes

dompurify 3.5.1, released December 2, 2026: 3 breaking changes.

- **Behavior changed** `sanitize`  

A DOM node named BODY or HTML outside the HTML namespace is no longer used as the walk root and is removed. Code relying on it being used as the root must change. [github.com](https://github.com/cure53/DOMPurify/releases/tag/3.5.1)
- **Signature changed** `DOMPurify.sanitize`  

With RETURN_DOM or RETURN_DOM_FRAGMENT, sanitize() now returns a type that includes null, so TypeScript callers may need a null check. [npmjs.com](https://www.npmjs.com/package/dompurify/v/3.5.1)
- **Signature changed** `WindowLike`  

Was type WindowLike = Pick\<typeof globalThis, 'DocumentFragment' | 'HTMLTemplateElement' | 'Node' | 'Element' | 'NodeFilter' | 'NamedNodeMap' | 'HTMLFormElement' | 'DOMParser'> & {document?: Document; MozNamedAttrMap?: typeof... [npmjs.com](https://www.npmjs.com/package/dompurify/v/3.5.1)

## dompurify 3.5.0 breaking changes

dompurify 3.5.0, released November 22, 2026: 6 breaking changes.

- **Behavior changed**  

When a DOM node is passed in, a textarea or title holding an element child and a void element holding children are now removed. [github.com](https://github.com/cure53/DOMPurify/releases/tag/3.5.0)
- **Behavior changed** `CUSTOM_ELEMENT_HANDLING.tagNameCheck`  

A name passing CUSTOM_ELEMENT_HANDLING.tagNameCheck is only kept in HTML; inside SVG or MathML it is now removed. [github.com](https://github.com/cure53/DOMPurify/releases/tag/3.5.0)
- **Behavior changed** `IN_PLACE`  

IN_PLACE now throws when a hook or custom element keeps putting a removed node back, instead of returning the node or running indefinitely. [github.com](https://github.com/cure53/DOMPurify/releases/tag/3.5.0)
- **Behavior changed** `SAFE_FOR_TEMPLATES`  

The guarantee now applies to string input only; for DOM node input and IN_PLACE it is best effort. [github.com](https://github.com/cure53/DOMPurify/releases/tag/3.5.0)
- **Behavior changed** `sanitize`  

A sanitize() call made from a hook no longer changes how the rest of the outer call behaves. Code relying on the old side effect must pass the config explicitly. [github.com](https://github.com/cure53/DOMPurify/releases/tag/3.5.0)
- **Signature changed** `DOMPurify.sanitize`  

Was sanitize(dirty: string | Node, cfg: Config & {RETURN_DOM: true;}): Node; now sanitize(dirty: string | Node, cfg: Config & {RETURN_DOM: true;}): Element. [npmjs.com](https://www.npmjs.com/package/dompurify/v/3.5.0)

## dompurify 3.4.18 breaking changes

dompurify 3.4.18, released November 14, 2026: 1 breaking change.

- **Removed**  

Entries in the SVG tag allow-list that were attributes rather than elements have been removed, so code relying on those names being allowed as tags may now see them stripped. [github.com](https://github.com/cure53/DOMPurify/releases/tag/3.4.18)

## dompurify 3.4.12 breaking changes

dompurify 3.4.12, released July 11, 2026: 2 breaking changes.

- **Behavior changed**  

Hooks that remove elements are now handled more strictly, so code relying on the previous handling may behave differently. Review custom hooks that remove nodes. [github.com](https://github.com/cure53/DOMPurify/releases/tag/3.4.12)
- **Behavior changed**  

Declarative partial updates are now handled more strictly, so code relying on the previous handling may behave differently. [github.com](https://github.com/cure53/DOMPurify/releases/tag/3.4.12)

## dompurify 3.4.8 breaking changes

dompurify 3.4.8, released June 3, 2026: 1 breaking change.

- **Signature changed** `Config.TRUSTED_TYPES_POLICY`  

Was TRUSTED_TYPES_POLICY?: TrustedTypePolicy | undefined; now TRUSTED_TYPES_POLICY?: TrustedTypePolicy | null | undefined. [npmjs.com](https://www.npmjs.com/package/dompurify/v/3.4.8)

## dompurify 3.4.7 breaking changes

dompurify 3.4.7, released May 27, 2026: 1 breaking change.

- **Behavior changed** `IN_PLACE`  

Handling of Shadow Roots when using IN_PLACE was hardened, so sanitized output may differ for code that relies on it. Check code that uses IN_PLACE with Shadow Roots. [github.com](https://github.com/cure53/DOMPurify/releases/tag/3.4.7)

## Older versions

5 older versions.

### dompurify 3.4.0 breaking changes

dompurify 3.4.0, released April 14, 2026: 2 breaking changes.

- **Behavior changed** `ADD_ATTR`  

Attribute predicates passed to ADD_ATTR are now subject to URI validation, so code that relied on them skipping it may see different output. [github.com](https://github.com/cure53/DOMPurify/releases/tag/3.4.0)
- **Behavior changed** `ADD_TAGS`  

The function form of ADD_ATTR/ADD_TAGS no longer persists into subsequent array-based calls, so code that relied on that carry-over must pass its settings explicitly. [github.com](https://github.com/cure53/DOMPurify/releases/tag/3.4.0)

### dompurify 3.3.1 breaking changes

dompurify 3.3.1, released December 8, 2025: 1 breaking change.

- **Behavior changed** `ADD_FORBID_CONTENTS`  

The ADD_FORBID_CONTENTS setting now adds to the default list instead of replacing it. Code that relied on the default list being overridden may now sanitize more content. [github.com](https://github.com/cure53/DOMPurify/releases/tag/3.3.1)

### dompurify 3.3.0 breaking changes

dompurify 3.3.0, released October 13, 2025: 2 breaking changes.

- **Signature changed** `Config.ADD_ATTR`  

Was ADD_ATTR?: string\[\] | undefined; now ADD_ATTR?: string\[\] | ((attributeName: string, tagName: string) => boolean) | undefined. [npmjs.com](https://www.npmjs.com/package/dompurify/v/3.3.0)
- **Signature changed** `Config.ADD_TAGS`  

Was ADD_TAGS?: string\[\] | undefined; now ADD_TAGS?: string\[\] | ((tagName: string) => boolean) | undefined. [npmjs.com](https://www.npmjs.com/package/dompurify/v/3.3.0)

### dompurify 3.0.0 breaking changes

dompurify 3.0.0, released February 13, 2023: 1 breaking change.

- **Removed**  

All MSIE-only code was removed; users who still need MSIE support must stay on the 2.4.4 release. [github.com](https://github.com/cure53/DOMPurify/releases/tag/3.0.0)

### dompurify 2.0.0 breaking changes

dompurify 2.0.0, released September 12, 2019: 1 breaking change.

- **Default changed**  

By default, sanitizing now returns only string objects unless configured otherwise. Code that expects another return type must opt in to it explicitly. [github.com](https://github.com/cure53/DOMPurify/releases/tag/2.0.0)

## Check your code

These are the changes. To see which of them reach your code, [scan a public repository](https://since.dev/scan.md), or have your coding agent call `check_code` with your manifest or lockfile over [MCP](https://since.dev/docs.md#mcp). [The API](https://since.dev/docs.md#api) reads every change in every version. A fix pull request opens for the changes that reach a connected repository. Nothing merges or deploys.

## Put your code on continuous maintenance.

Scan a public repository now, or give your agent one line.

[Scan a repository](https://since.dev/scan.md). Any public GitHub repository. No sign-in.

### Tell your agent what changed since it was trained.

`claude mcp add --transport http since https://api.since.dev/mcp`

[Get an API key](https://app.since.dev/login?mode=signup)

Codex, Cursor and any MCP client use https://api.since.dev/mcp.

---

Every page on this site as Markdown: https://since.dev/sitemap.md. For agents: https://since.dev/llms.txt.
