# What changed in htmlparser2

> 26 changes in htmlparser2 10 to 12 from its official release notes, upgrade guides and advisories: 17 breaking, 1 new APIs and options. Each one cited. Sources checked 2026-10-28. HTML: https://unstale.sh/npm/htmlparser2/

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

## htmlparser2 12

### Breaking changes

- In HTML mode, processing instructions and non-DOCTYPE declarations emit bogus comments instead of being silently dropped. (12.0.0) — [release notes](https://github.com/fb55/htmlparser2/releases/tag/v12.0.0)
- CDATA sections inside foreign content are treated as text. (12.0.0) — [release notes](https://github.com/fb55/htmlparser2/releases/tag/v12.0.0)
- An empty end tag is silently ignored rather than emitted as text. (12.0.0) — [release notes](https://github.com/fb55/htmlparser2/releases/tag/v12.0.0)
- An h1–h6 element implicitly closes other headings. (12.0.0) — [release notes](https://github.com/fb55/htmlparser2/releases/tag/v12.0.0)
- image is rewritten to img outside foreign content. (12.0.0) — [release notes](https://github.com/fb55/htmlparser2/releases/tag/v12.0.0)
- A nested form is ignored when another form is already open. (12.0.0) — [release notes](https://github.com/fb55/htmlparser2/releases/tag/v12.0.0)
- iframe, noembed, noframes, and plaintext content is no longer parsed as HTML. (12.0.0) — [release notes](https://github.com/fb55/htmlparser2/releases/tag/v12.0.0)
- Self-closing script and style tags enter raw-text state when recognizeSelfClosing is not enabled; the slash is ignored per spec. (12.0.0) — [release notes](https://github.com/fb55/htmlparser2/releases/tag/v12.0.0)
- Special-tag detection is disabled inside foreign content. (12.0.0) — [release notes](https://github.com/fb55/htmlparser2/releases/tag/v12.0.0)
- Tag names inside svg are adjusted per spec, including foreignObject and clipPath. (12.0.0) — [release notes](https://github.com/fb55/htmlparser2/releases/tag/v12.0.0)
- textarea now decodes entities, matching title behavior. (12.0.0) — [release notes](https://github.com/fb55/htmlparser2/releases/tag/v12.0.0)

### Fixes and other changes

- An a element closes a previously open a element. (12.0.0) — [release notes](https://github.com/fb55/htmlparser2/releases/tag/v12.0.0)
- DOCTYPE declarations without a space after DOCTYPE are recognized. (12.0.0) — [release notes](https://github.com/fb55/htmlparser2/releases/tag/v12.0.0)
- Unclosed comments, DOCTYPEs, processing instructions, and CDATA sections emit the correct token type at EOF. (12.0.0) — [release notes](https://github.com/fb55/htmlparser2/releases/tag/v12.0.0)
- Stray svg and math end tags no longer corrupt parser context tracking. (12.0.0) — [release notes](https://github.com/fb55/htmlparser2/releases/tag/v12.0.0)
- Several comment forms that were previously invalid are now parsed as valid comments per spec. (12.0.0) — [release notes](https://github.com/fb55/htmlparser2/releases/tag/v12.0.0)
- reset() now clears attribute state, preventing data from leaking across parseComplete() calls. (12.0.0) — [release notes](https://github.com/fb55/htmlparser2/releases/tag/v12.0.0)

## htmlparser2 11

### Breaking changes

- The module is ESM only; CommonJS require() is no longer supported in legacy environments, so use import instead. (11.0.0) — [release notes](https://github.com/fb55/htmlparser2/releases/tag/v11.0.0)
- The minimum supported Node.js version is now 20.19.0. (11.0.0) — [release notes](https://github.com/fb55/htmlparser2/releases/tag/v11.0.0)
- The deprecated parseDOM function was removed. (11.0.0) — [release notes](https://github.com/fb55/htmlparser2/releases/tag/v11.0.0)
- In xmlMode, <!--> is no longer treated as a complete comment. (11.0.0) — [release notes](https://github.com/fb55/htmlparser2/releases/tag/v11.0.0)
- XML processing instructions now require the full ?> closing sequence instead of just >. (11.0.0) — [release notes](https://github.com/fb55/htmlparser2/releases/tag/v11.0.0)

### New APIs and options

- Added WebWritableStream for the Web Streams API, enabling direct piping from fetch() response bodies into the parser. (11.0.0) — [release notes](https://github.com/fb55/htmlparser2/releases/tag/v11.0.0)

### Fixes and other changes

- In HTML mode, comments accept --!> as a closing sequence, and <!--> is recognized as an empty comment. (11.0.0) — [release notes](https://github.com/fb55/htmlparser2/releases/tag/v11.0.0)
- reset() now clears isSpecial and sequenceIndex state, preventing incorrect parsing after reuse. (11.0.0) — [release notes](https://github.com/fb55/htmlparser2/releases/tag/v11.0.0)

## htmlparser2 10

### Breaking changes

- Test files are no longer included in the published module, changing the files available to consumers of the package. (10.1.0) — [release notes](https://github.com/fb55/htmlparser2/releases/tag/v10.1.0)
