NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
npm · #389 most downloaded on npm
Fast & forgiving HTML/XML parser
Last release 6 months ago
20 Mar 2026
Release timing varies
gaps range from 8 days to 13 months
Some releases are documented
notes for 21 of the last 60 stable releases
Nothing withdrawn
no release was ever pulled
15 years old
80 releases · first in 2011
This release aligns HTML parsing with the WHATWG spec Almost all changes are to HTML mode only — XML mode is unaffected unless noted.
This release aligns HTML parsing with the WHATWG spec Almost all changes are to HTML mode only — XML mode is unaffected unless noted.
Raw-text & RCDATA tags
<iframe>, <noembed>, <noframes>, and <plaintext> are now raw-text tags, their content is no longer parsed as HTML<textarea> now decodes entities like <title> already did<script/>, <style/>, etc. now enter their raw-text state (the / is ignored per spec) unless recognizeSelfClosing is enabledSVG & MathML
<svg> are case-adjusted per spec (foreignObject, clipPath, etc.)</svg> / </math> no longer corrupt the parser's context trackingComments & declarations
<!-->, <!--->, <!->, <!> now parse as valid comments per spec<?…> and non-DOCTYPE <!…> in HTML mode emit bogus comments instead of being silently dropped<!DOCTYPEhtml> (no space) is recognized as a DOCTYPE<!DOCTYPE, <?…, <![CDATA[… at EOF emit the correct token typeImplicit open/close
<h1>–<h6> implicitly close other headings<a> closes a previous <a><form> is ignored when one is already open<image> is rewritten to <img> outside foreign content</> is silently ignored instead of emitted as textOther fixes
reset() not clearing attribute state, which could leak data across parseComplete() callsFull Changelog: v11.0.0...v12.0.0
One column per quarter.
The deprecated parseDOM function was removed.
require() is not supported in legacy environment anymore. Use import instead.domhandler v6, domutils v4, domelementtype v3, entities v8.parseDOM function was removed.WebWritableStream for the Web Streams API, enabling direct piping from fetch() response bodies into the parser #2376--!> as a closing sequence per the HTML spec, and <!--> is recognized as an empty comment in HTML mode #2382<?xml ... ?>) now require the full ?> closing sequence instead of just > #2382reset() not clearing isSpecial and sequenceIndex state, which could cause incorrect parsing after reuse #2382<!--> is no longer treated as a complete comment in xmlMode #2383Full Changelog: v10.1.0...v11.0.0
entities was bumped from 6.0.1 to 7.0.1, bringing size & speed improvements #2215
Full Changelog: v10.0.0...v10.1.0
Breaking: Simplify writable stream import path d5882db
Fixed onattribend 's endIndex ( #1540 by @DimaIT )
Added a createDocumentStream function, analogous to createDomStream (which is now deprecated) #1510
EntityDecoder from the entities module #1480
<a href='&=boo'> the attribute value won't be modified any more.ontextentity tokenizer callback now has an endIndex argument; if you use the tokenizer directly, make sure indices are still the same.createDocumentStream function, analogous to createDomStream (which is now deprecated) #1510Full Changelog: v8.0.2...v9.0.0
Reset tokenizer baseState after closing tag name by @KillyMXI in #1460
eslint-plugin-n and -unicorn by @fb55 in #1352Full Changelog: v8.0.1...v8.0.2
Added missing WritableStream export in the package.json 6923fca
WritableStream export in the package.json 6923fcaThe deprecated FeedHandler class has been removed #1166
FeedHandler class has been removed #1166
domhandler and domutils have changed, the deprecated normalizeWhitespace option was removed #1164Parser.write() and Parser.end() now only accept string arguments. If you were previouslyparser.write(buffer.toString())), or usehtmlparser2 is now a dual CommonJS & ESM module #1165entities' updated decoding tree structure #1146parse5 for HTML compliance by @vassudanagunta in #1147Full Changelog: v7.2.0...v8.0.0
Decode entities after < by @fb55 in #1008
Fixes:
Docs
parseDocument() example clearer by @cameronsteele in #998Refactors:
The refactors lead to a combined ~5% speed-up.
Full Changelog: v7.1.2...v7.2.0
Fix indices of self-closing tags in XML (#949, reported in #941) 3287ef2
https://github.com/fb55/htmlparser2/compare/v7.1.1...v7.1.2
Fixed a bug where implied close tags would be misreported (#933) 903fb43
endIndex of text events being off by 1 (#932) 78ef1b7https://github.com/fb55/htmlparser2/compare/v7.1.0...v7.1.1
Added an isImplied flag to the onopentag/onclosetag events (#930) f917004
Features:
isImplied flag to the onopentag/onclosetag events (#930) f917004
Fixes:
htmlparser2@7.0.0 changed how indices were computed. Unfortunately, a lot of edge-cases weren't handled correctly. This version fixes this.
.pause would lead to data being wrongfully discarded (#927) 78af88dforeignObject will always be lowercased in HTML e852205Refactors:
getFeed to domutils (#931) f10dc03stream tests into WritableStream.spec (#916) da67ebahttps://github.com/fb55/htmlparser2/compare/v7.0.0...v7.1.0
htmlparser2@7.0.0 changes a lot of internals, resulting in an 20% overall performance improvement in AndreasMadsen's htmlparser-benchmark.
htmlparser2@7.0.0 changes a lot of internals, resulting in an 20% overall performance improvement in AndreasMadsen's htmlparser-benchmark.
Breaking changes:
Features:
isVoidElement method to the parser (#785) 00ce57aRefactors:
Map for openImpliesClose in the parser (#911) 39a8109FeedHandler to a function (#912) 3a672ffExport tokenizer callback interface from main module (#751) ab0b3fc f59473a
Features:
Fixes:
Upgrades:
https://github.com/fb55/htmlparser2/compare/v6.0.1...v6.1.0
Fix parsing special closing tags (#746) 214ab08
https://github.com/fb55/htmlparser2/compare/v6.0.0...v6.0.1
You likely want to use this instead of the now deprecated getDOM method.
Breaking:
Features:
parseDocument method 4653f23
getDOM method.Minor:
https://github.com/fb55/htmlparser2/compare/v5.0.1...v6.0.0
Fix: Parse entities in tags (#614, #615 by @billneff79) 3295a8b
<title> tags (#614, #615 by @billneff79) 3295a8bAlso pulls in a new version of the entities module, which features more compact entity maps.
Default the decodeEntities option to true 8ac01e0
Breaking changes:
decodeEntities option to true 8ac01e0EVENTS, WritableStream and CollectingHandler exports from module import. The latter two are still part of the module, but now have to be imported explicitly. 6e296d2EventEmitter f30f13c<title> tag content is now processed as text (#483 by @billneff79) 0189e56Features:
onattribute event 3c86256Bug Fixes:
Diverse:
getOneElement (#543 by @brettz9) 1cf297eThanks to everyone that contributed to this release!
Commit Range: https://github.com/fb55/htmlparser2/compare/v4.1.0...v5.0.0
Don't fail when parsing <__proto__> (fixes #387)
<__proto__> (fixes #387)types field to package.jsonRemove the Stream and ProxyHandler exports
Stream and ProxyHandler exportsNothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Your coding agent can read these notes before it upgrades. Set up the MCP server →