unstale

npm / parse5

parse5

What changed in parse5 4 to 8, from its official release notes, upgrade guides and advisories. Sources checked 2026-10-23.

13 breaking7 new APIs and options2 performance5 behavior and defaults1 tooling3 fixes and other

See which of these apply to your code, ranked, in your agent:

npx @unstale/cli init

@unstale/cli 0.2.3 on npm

parse5 82 changes

Breaking changes 1

  • parse5 is now ESM-only; applications using CommonJS must adapt their imports.

    8.0.0release notes

Performance 1

  • Uses String.fromCharCode for BMP characters in the tokenizer, a performance optimization.

    8.0.1release notes

parse5 715 changes

Breaking changes 5

  • All parse5 packages are now ECMAScript Modules; dual packages are provided for parse5 and parse5-htmlparser2-tree-adapter.

    7.0.0release notes

  • Parsing results might differ in edge cases as parse5 catches up with the HTML spec.

    7.0.0release notes

  • The adapter now uses domhandler’s node interface, and the format of tree nodes has changed slightly.

    7.0.0release notes

  • The package was removed; use the serialize function exported by parse5.

    7.0.0release notes

  • The rewriting stream no longer escapes text in special tags.

    7.0.0release notes

New APIs and options 4

  • Support for fragments was added to the parser stream.

    7.0.0release notes

  • Added the scriptingEnabled option.

    7.0.0release notes

  • Added serializeOuter, like .outerHTML.

    7.0.0release notes

  • Hooks for stack events were added to the tree adapter interface.

    7.0.0release notes

Performance 1

  • Version 7.0.0 is reported as 45% faster with default options and 167% faster with location information enabled in the bench/perf benchmark on an M1 Mac.

    7.0.0release notes

Behavior and default changes 1

  • The rewriting stream now splits very long text sections.

    7.0.0release notes

Tooling 1

  • parse5 now ships its own types, so remove @types/parse5*.

    7.0.0release notes

Fixes and other changes 3

  • Fixed parsing of << in comments, which was wrongly parsed as <!.

    7.0.0release notes

  • Fixed the position of endTag for mixed-case foreign elements.

    7.0.0release notes

  • Fixed the end position of html and body.

    7.0.0release notes

parse5 61 changes

Breaking changes 1

  • The Tree adapter interface adds this method, enabling usage of custom location info formats; the change is breaking.

    6.0.0release notes

parse5 58 changes

Breaking changes 5

  • Functionality is shipped in separate packages; the parse5 package contains only basic functionality.

    5.0.0release notes

  • SAXParser now passes token objects to event handlers instead of separate arguments.

    5.0.0release notes

  • The location info property name used by currently implemented tree adapters changes from __location to sourceCodeLocation.

    5.0.0release notes

  • The location info property line is renamed to startLine.

    5.0.0release notes

  • parse5 no longer ships TypeScript definitions; existing definitions have moved to DefinitelyTyped.

    5.0.0release notes

New APIs and options 3

  • Adds the endLine location info property.

    5.0.0release notes

  • Adds an HTML rewriting stream package.

    5.0.0release notes

  • Tree adapters should implement this method to control the source code location property.

    5.0.0release notes

parse5 45 changes

Breaking changes 1

  • TypeScript definitions are disabled by default; developers must enable them to use the definitions.

    4.0.0release notes

Behavior and default changes 4

  • This Node.js-specific API is now lazily loaded, enabling bundling of basic functionality for other platforms.

    4.0.0release notes

  • This Node.js-specific API is now lazily loaded, enabling bundling of basic functionality for other platforms.

    4.0.0release notes

  • This Node.js-specific API is now lazily loaded, enabling bundling of basic functionality for other platforms.

    4.0.0release notes

  • This Node.js-specific API is now lazily loaded, enabling bundling of basic functionality for other platforms.

    4.0.0release notes