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
On this page
Latest version 3.5.1, released December 2, 2026. Source repository
Packages on npm run on Node.js. Node.js end of life dates.
dompurify 3.5.1 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 - 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 - Signature changed
WindowLike
Was type WindowLike = Pick<typeof globalThis, 'DocumentFragment' | 'HTMLTemplateElement' | 'Node' | 'Element' | 'NodeFilter' | 'NamedNodeMap' | 'HTMLFormElement' | 'DOMParser'> & {document?: Document; MozNamedAttrMap?: typeof... npmjs.com
dompurify 3.5.0 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 - 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 - 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 - 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 - 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 - 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
dompurify 3.4.18 breaking changes
- 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
dompurify 3.4.12 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 - Behavior changed
Declarative partial updates are now handled more strictly, so code relying on the previous handling may behave differently. github.com
dompurify 3.4.8 breaking changes
- Signature changed
Config.TRUSTED_TYPES_POLICY
Was TRUSTED_TYPES_POLICY?: TrustedTypePolicy | undefined; now TRUSTED_TYPES_POLICY?: TrustedTypePolicy | null | undefined. npmjs.com
dompurify 3.4.7 breaking changes
- 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
Older versions
5 older versions.
Show 5 older versions
dompurify 3.4.0 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 - 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
dompurify 3.3.1 breaking changes
- 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
dompurify 3.3.0 breaking changes
- Signature changed
Config.ADD_ATTR
Was ADD_ATTR?: string[] | undefined; now ADD_ATTR?: string[] | ((attributeName: string, tagName: string) => boolean) | undefined. npmjs.com - Signature changed
Config.ADD_TAGS
Was ADD_TAGS?: string[] | undefined; now ADD_TAGS?: string[] | ((tagName: string) => boolean) | undefined. npmjs.com
dompurify 3.0.0 breaking changes
- Removed
All MSIE-only code was removed; users who still need MSIE support must stay on the 2.4.4 release. github.com
dompurify 2.0.0 breaking changes
- 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
Check your code
These are the changes. To see which of them reach your code, scan a public repository, or have your coding agent call check_code with your manifest or lockfile over MCP. The 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.
See how out of date your code is.
Tell your agent what changed since it was trained.
claude mcp add --transport http since https://api.since.dev/mcpCodex, Cursor and any MCP client use https://api.since.dev/mcp.