sanitize-html breaking changes
sanitize-html 2.0.0 (September 23, 2020) is its newest release with breaking changes, 28 of them. The first: Browser-linkable build file is no longer provided in sanitize-html 2.0.0. Every breaking API change we have recorded in sanitize-html on npm: 30 breaking changes in 3 versions. Below, its 3 versions with breaking changes, newest first, removals and renames first, each with its source.
Updated December 4, 2026
On this page
Latest version 2.18.2, released November 11, 2026. Source repository
Its 2.0.0 release requires Node.js 10 or later. Node.js end of life dates.
- From 2.0.0-beta to 2.0.0: 29 breaking changes in 2 versions.
sanitize-html 2.0.0 breaking changes
- Removed
sanitize-html is no longer linked directly in the browser. Include it in your project build instead. github.com - Removed
Node.js 11 and 13 are no longer supported, and Node.js 10 or higher is now required. github.com - Default changed
allowedTags
The default allowedTags array now includes many more HTML tags. Review the defaults if you do not override them. github.com - Signature changed
AllowedAttribute
Was type AllowedAttribute = string | {name: string; multiple?: boolean; values: string[]}; now type AllowedAttribute = string | {name: string; multiple?: boolean | undefined; values: string[]}. npmjs.com - Signature changed
defaults
Was let defaults: IDefaults; now const defaults: IDefaults. npmjs.com - Signature changed
DisallowedTagsModes
Was type DisallowedTagsModes = 'discard' | 'escape' | 'recursiveEscape'; now type DisallowedTagsModes = "discard" | "escape" | "recursiveEscape" | "completelyDiscard". npmjs.com - Signature changed
IDefaults.allowedAttributes
Was allowedAttributes: {[index: string]: AllowedAttribute[]}; now allowedAttributes: Record<string, AllowedAttribute[]>. npmjs.com - Signature changed
IOptions.allowedAttributes
Was allowedAttributes?: {[index: string]: AllowedAttribute[]} | boolean; now allowedAttributes?: Record<string, AllowedAttribute[]> | false | undefined. npmjs.com - Signature changed
IOptions.allowedClasses
Was allowedClasses?: {[index: string]: string[] | boolean}; now allowedClasses?: {[index: string]: boolean | Array<string | RegExp>} | undefined. npmjs.com - Signature changed
IOptions.allowedIframeDomains
Was allowedIframeDomains?: string[]; now allowedIframeDomains?: string[] | undefined. npmjs.com - Signature changed
IOptions.allowedIframeHostnames
Was allowedIframeHostnames?: string[]; now allowedIframeHostnames?: string[] | undefined. npmjs.com - Signature changed
IOptions.allowedSchemes
Was allowedSchemes?: string[] | boolean; now allowedSchemes?: string[] | boolean | undefined. npmjs.com - Signature changed
IOptions.allowedSchemesAppliedToAttributes
Was allowedSchemesAppliedToAttributes?: string[]; now allowedSchemesAppliedToAttributes?: string[] | undefined. npmjs.com - Signature changed
IOptions.allowedSchemesByTag
Was allowedSchemesByTag?: {[index: string]: string[]} | boolean; now allowedSchemesByTag?: {[index: string]: string[]} | boolean | undefined. npmjs.com - Signature changed
IOptions.allowedStyles
Was allowedStyles?: {[index: string]: {[index: string]: RegExp[]}}; now allowedStyles?: {[index: string]: {[index: string]: RegExp[]}} | undefined. npmjs.com - Signature changed
IOptions.allowedTags
Was allowedTags?: string[] | boolean; now allowedTags?: string[] | false | undefined. npmjs.com - Signature changed
IOptions.allowIframeRelativeUrls
Was allowIframeRelativeUrls?: boolean; now allowIframeRelativeUrls?: boolean | undefined. npmjs.com - Signature changed
IOptions.allowProtocolRelative
Was allowProtocolRelative?: boolean; now allowProtocolRelative?: boolean | undefined. npmjs.com - Signature changed
IOptions.allowVulnerableTags
Was allowVulnerableTags?: boolean; now allowVulnerableTags?: boolean | undefined. npmjs.com - Signature changed
IOptions.disallowedTagsMode
Was disallowedTagsMode?: DisallowedTagsModes; now disallowedTagsMode?: DisallowedTagsModes | undefined. npmjs.com - Signature changed
IOptions.enforceHtmlBoundary
Was enforceHtmlBoundary?: boolean; now enforceHtmlBoundary?: boolean | undefined. npmjs.com - Signature changed
IOptions.exclusiveFilter
Was exclusiveFilter?: (frame: IFrame) => boolean; now exclusiveFilter?: ((frame: IFrame) => boolean | "excludeTag") | undefined. npmjs.com - Signature changed
IOptions.nonTextTags
Was nonTextTags?: string[]; now nonTextTags?: string[] | undefined. npmjs.com - Signature changed
IOptions.parser
Was parser?: ParserOptions; now parser?: ParserOptions | undefined. npmjs.com - Signature changed
IOptions.selfClosing
Was selfClosing?: string[]; now selfClosing?: string[] | undefined. npmjs.com - Signature changed
IOptions.textFilter
Was textFilter?: (text: string, tagName: string) => string; now textFilter?: ((text: string, tagName: string) => string) | undefined. npmjs.com - Signature changed
IOptions.transformTags
Was transformTags?: {[tagName: string]: string | Transformer}; now transformTags?: {[tagName: string]: string | Transformer} | undefined. npmjs.com - Signature changed
Tag.text
Was text?: string; now text?: string | undefined. npmjs.com
sanitize-html 2.0.0-beta.2 breaking changes
- Default changed
allowedTags
The default allowedTags no longer include iframe and nl. Pass them explicitly if your code needs them. github.com
sanitize-html 2.0.0-beta breaking changes
- Behavior changed
The package no longer ships a build. Projects that include sanitize-html must add it to their own build. 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.