# What changed in dompurify

> 69 changes in dompurify 3 from its official release notes, upgrade guides and advisories: 3 breaking, 48 security. Each one cited. Sources checked 2026-10-17. HTML: https://unstale.sh/npm/dompurify/

To see which of these apply to a repository, run `npx @unstale/cli init` in it.

## dompurify 3

### Breaking changes

- The function form of ADD_TAGS no longer bypasses FORBID_TAGS. (3.4.0) — [release notes](https://github.com/cure53/DOMPurify/releases/tag/3.4.0)
- The default forbidden-content list was extended, affecting which content DOMPurify blocks by default. (3.3.1) — [release notes](https://github.com/cure53/DOMPurify/releases/tag/3.3.1)
- The ESM import syntax was corrected, so developers may need to update their imports. (3.3.1) — [release notes](https://github.com/cure53/DOMPurify/releases/tag/3.3.1)

### Security

- Fixed the SMIL attributeName guard in XHTML mode. (3.4.17) — [release notes](https://github.com/cure53/DOMPurify/releases/tag/3.4.17)
- Hardened smaller edge cases involving isValidAttribute(). (3.4.17) — [release notes](https://github.com/cure53/DOMPurify/releases/tag/3.4.17)
- Hardened smaller edge cases involving literal-text elements. (3.4.17) — [release notes](https://github.com/cure53/DOMPurify/releases/tag/3.4.17)
- Hardened smaller namespace-related edge cases. (3.4.17) — [release notes](https://github.com/cure53/DOMPurify/releases/tag/3.4.17)
- Fixed node removal with IN_PLACE when hooks are used. (3.4.16) — [release notes](https://github.com/cure53/DOMPurify/releases/tag/3.4.16), [security advisory](https://github.com/advisories/GHSA-P98J-92PF-MC4P)
- Fixed IN_PLACE sanitization for raw-text roots. (3.4.16) — [release notes](https://github.com/cure53/DOMPurify/releases/tag/3.4.16), [security advisory](https://github.com/advisories/GHSA-6688-9RHM-GJV2)
- Added several smaller hardening and edge-case improvements. (3.4.15) — [release notes](https://github.com/cure53/DOMPurify/releases/tag/3.4.15)
- Improved clobbering hardening when XML content is involved. (3.4.15) — [release notes](https://github.com/cure53/DOMPurify/releases/tag/3.4.15)
- Fixed possible bypasses when risky tags are allow-listed. (3.4.14) — [release notes](https://github.com/cure53/DOMPurify/releases/tag/3.4.14)
- Fixed hooks potentially bypassing the clone guard. (3.4.13) — [release notes](https://github.com/cure53/DOMPurify/releases/tag/3.4.13)
- Fixed hook removal during IN_PLACE sanitization. (3.4.13) — [release notes](https://github.com/cure53/DOMPurify/releases/tag/3.4.13), [security advisory](https://github.com/advisories/GHSA-55Q2-FJHQ-7XH7)
- Fixed DOM clobbering through ownerDocument during IN_PLACE sanitization. (3.4.13) — [release notes](https://github.com/cure53/DOMPurify/releases/tag/3.4.13)
- Handling of declarative partial updates was hardened. (3.4.12) — [release notes](https://github.com/cure53/DOMPurify/releases/tag/3.4.12)
- Hooks are now called for custom elements. (3.4.12) — [release notes](https://github.com/cure53/DOMPurify/releases/tag/3.4.12), [security advisory](https://github.com/advisories/GHSA-C2J3-45GR-MQC4)
- Handling of hooks that remove elements was hardened. (3.4.12) — [release notes](https://github.com/cure53/DOMPurify/releases/tag/3.4.12)
- Fixed a leaky configuration issue affecting hooks configured through setConfig. (3.4.11) — [release notes](https://github.com/cure53/DOMPurify/releases/tag/3.4.11), [security advisory](https://github.com/advisories/GHSA-CMWH-PVXP-8882)
- DOMPurify: Trusted Types policy survives `clearConfig()` and can poison later `RETURN_TRUSTED_TYPE` output (3.4.9) — [security advisory](https://github.com/advisories/GHSA-VXR8-FQ34-VVX9)
- DOMPurify: SAFE_FOR_TEMPLATES bypass - template expressions survive sanitization inside <template> content when using DOM output modes (3.4.8) — [security advisory](https://github.com/advisories/GHSA-GVMJ-G25R-R7WR)
- Fixed the node iterator for better template scrubbing. (3.4.8) — [release notes](https://github.com/cure53/DOMPurify/releases/tag/3.4.8)
- Removed a problem that could lead to permanent hook pollution. (3.4.7) — [release notes](https://github.com/cure53/DOMPurify/releases/tag/3.4.7), [security advisory](https://github.com/advisories/GHSA-76MC-F452-CXCM)
- Hardened Shadow Root handling when using IN_PLACE. (3.4.7) — [release notes](https://github.com/cure53/DOMPurify/releases/tag/3.4.7), [security advisory](https://github.com/advisories/GHSA-RP9W-3FW7-7CWQ)
- DOMPurify: Cross-realm IN_PLACE sanitization leaves executable markup intact via realm-bound `instanceof` checks (3.4.6) — [security advisory](https://github.com/advisories/GHSA-HPCV-96WG-7VJ8)
- DOMPurify: IN_PLACE mode preserves attributes of a clobbered root element, allowing XSS via attacker-controlled root DOM (3.4.6) — [security advisory](https://github.com/advisories/GHSA-R47G-FVHR-H676)
- Fixed several DOM Clobbering issues when using IN_PLACE mode. (3.4.6) — [release notes](https://github.com/cure53/DOMPurify/releases/tag/3.4.6)
- Hardened checks for cross-realm IN_PLACE usage and Shadow DOM sanitization. (3.4.6) — [release notes](https://github.com/cure53/DOMPurify/releases/tag/3.4.6)
- Fixed a bypass caused by the new HTML element selectedcontent introduced in 3.4.4; upgrade immediately because this is a security release. (3.4.5) — [release notes](https://github.com/cure53/DOMPurify/releases/tag/3.4.5), [security advisory](https://github.com/advisories/GHSA-87XG-PXX2-7HVX)
- Made template regexes more robust against ReDoS attacks. (3.4.3) — [release notes](https://github.com/cure53/DOMPurify/releases/tag/3.4.3)
- Fixed URI validation for attributes allowed through the ADD_ATTR callback. (3.4.2) — [release notes](https://github.com/cure53/DOMPurify/releases/tag/3.4.2)
- The annotation-xml check now handles mixed-case variants in XHTML mode, preventing bypass of basic custom-element exclusion. (3.4.1) — [release notes](https://github.com/cure53/DOMPurify/releases/tag/3.4.1)
- Permissive custom-element handling now correctly strips on-handlers from HTML-spec-reserved custom element names. (3.4.1) — [release notes](https://github.com/cure53/DOMPurify/releases/tag/3.4.1)
- The root-node check now guards against non-string nodeName values to improve DOM-clobbering robustness. (3.4.1) — [release notes](https://github.com/cure53/DOMPurify/releases/tag/3.4.1)
- ADD_ATTR function configuration no longer leaks into subsequent array-based calls. (3.4.0) — [release notes](https://github.com/cure53/DOMPurify/releases/tag/3.4.0)
- ADD_ATTR predicates now perform URI validation instead of skipping it. (3.4.0) — [release notes](https://github.com/cure53/DOMPurify/releases/tag/3.4.0)
- ADD_TAGS function configuration no longer leaks into subsequent array-based calls. (3.4.0) — [release notes](https://github.com/cure53/DOMPurify/releases/tag/3.4.0)
- An issue involving closing tags that could enable mXSS was fixed. (3.4.0) — [release notes](https://github.com/cure53/DOMPurify/releases/tag/3.4.0)
- DOMPurify: FORBID_TAGS bypassed by function-based ADD_TAGS predicate (asymmetry with FORBID_ATTR fix) (3.4.0) — [security advisory](https://github.com/advisories/GHSA-H7MW-GPVR-XQ4M)
- DOMPurify has a SAFE_FOR_TEMPLATES bypass in RETURN_DOM mode (3.4.0) — [security advisory](https://github.com/advisories/GHSA-CRV5-9VWW-Q3G8)
- DOMPurify: Prototype Pollution to XSS Bypass via CUSTOM_ELEMENT_HANDLING Fallback (3.4.0) — [security advisory](https://github.com/advisories/GHSA-V9JR-RG53-9PGP), [release notes](https://github.com/cure53/DOMPurify/releases/tag/3.4.0)
- DOMPurify's ADD_TAGS function form bypasses FORBID_TAGS due to short-circuit evaluation (3.4.0) — [security advisory](https://github.com/advisories/GHSA-39Q2-94RC-95CP)
- FORBID_TAGS now takes precedence over ADD_TAGS when both configure allowed and forbidden tags. (3.4.0) — [release notes](https://github.com/cure53/DOMPurify/releases/tag/3.4.0)
- An issue that could enable mXSS through Re-Contextualization was fixed. (3.4.0) — [release notes](https://github.com/cure53/DOMPurify/releases/tag/3.4.0)
- SAFE_FOR_TEMPLATES scrubbing now also applies when using the RETURN_DOM path. (3.4.0) — [release notes](https://github.com/cure53/DOMPurify/releases/tag/3.4.0)
- Fixed a prototype pollution issue when working with custom elements. (3.3.2) — [release notes](https://github.com/cure53/DOMPurify/releases/tag/3.3.2)
- DOMPurify ADD_ATTR predicate skips URI validation (3.3.2) — [security advisory](https://github.com/advisories/GHSA-CJMM-F4JC-QW8R)
- DOMPurify contains a Cross-site Scripting vulnerability (2.5.9, 3.3.2) — [security advisory](https://github.com/advisories/GHSA-V2WJ-7WPQ-C8VV)
- DOMPurify is vulnerable to mutation-XSS via Re-Contextualization (3.3.2) — [security advisory](https://github.com/advisories/GHSA-H8R8-WCCR-V5F2)
- DOMPurify USE_PROFILES prototype pollution allows event handlers (3.3.2) — [security advisory](https://github.com/advisories/GHSA-CJ63-JHHR-WCXV), [release notes](https://github.com/cure53/DOMPurify/releases/tag/3.4.0)
- Fixed a possible bypass caused by faulty raw-text tag parsing in jsdom. (2.5.9, 3.3.2) — [release notes](https://github.com/cure53/DOMPurify/releases/tag/3.3.2), [release notes](https://github.com/cure53/DOMPurify/releases/tag/2.5.9)

### Performance

- Improved sanitizer performance by hoisting mXSS probe regexes and testing textContent before innerHTML. (3.4.10) — [release notes](https://github.com/cure53/DOMPurify/releases/tag/3.4.10)

### Behavior and default changes

- Added the SVG pointer-events presentation attribute to the allow-list. (3.4.14) — [release notes](https://github.com/cure53/DOMPurify/releases/tag/3.4.14)
- Added the SVG vector-effect presentation attribute to the allow-list. (3.4.14) — [release notes](https://github.com/cure53/DOMPurify/releases/tag/3.4.14)
- Support was added for a few new SVG attributes. (3.4.12) — [release notes](https://github.com/cure53/DOMPurify/releases/tag/3.4.12)

### Tooling

- Added a deterministic micro-benchmark harness with a comparison mode for evaluating performance changes. (3.4.10) — [release notes](https://github.com/cure53/DOMPurify/releases/tag/3.4.10)

### Fixes and other changes

- Fixed IN_PLACE handling of nodes that hooks or custom elements tough during sanitization. (3.4.17) — [release notes](https://github.com/cure53/DOMPurify/releases/tag/3.4.17)
- Fixed an issue involving IN_PLACE, SAFE_FOR_TEMPLATES and shadow roots during sanitization. (3.4.17) — [release notes](https://github.com/cure53/DOMPurify/releases/tag/3.4.17)
- Fixed ESM default exports appearing in CommonJS declarations. (3.4.16) — [release notes](https://github.com/cure53/DOMPurify/releases/tag/3.4.16)
- Fixed edge cases involving mixed document contexts. (3.4.14) — [release notes](https://github.com/cure53/DOMPurify/releases/tag/3.4.14)
- Handling of IN_PLACE sanitization was further improved. (3.4.9) — [release notes](https://github.com/cure53/DOMPurify/releases/tag/3.4.9)
- Handling of Trusted Types config options was further improved. (3.4.9) — [release notes](https://github.com/cure53/DOMPurify/releases/tag/3.4.9)
- Fixed an issue with handling of Trusted Types policies. (3.4.8) — [release notes](https://github.com/cure53/DOMPurify/releases/tag/3.4.8)
- Improved handling of nested Shadow DOM trees and related iteration issues. (3.4.3) — [release notes](https://github.com/cure53/DOMPurify/releases/tag/3.4.3)
- Fixed source maps that referred to non-existing files. (3.4.2) — [release notes](https://github.com/cure53/DOMPurify/releases/tag/3.4.2)
- Repeated sanitization no longer repeatedly prefixes already-prefixed id and name values. (3.4.1) — [release notes](https://github.com/cure53/DOMPurify/releases/tag/3.4.1)
- Several minor MathML attribute handling problems and typos were fixed. (3.4.0) — [release notes](https://github.com/cure53/DOMPurify/releases/tag/3.4.0)
- Fixed a Node 20 engine requirement that caused hiccups. (3.3.3) — [release notes](https://github.com/cure53/DOMPurify/releases/tag/3.3.3)
- Fixed lenient config parsing in _isValidAttribute. (3.3.2) — [release notes](https://github.com/cure53/DOMPurify/releases/tag/3.3.2)
