parse5 vs jsdom vs cheerio vs domino
Choosing HTML processing, DOM construction or browser-like APIs
parse5jsdomcheeriodominoSimilar Packages:

Choosing HTML processing, DOM construction or browser-like APIs

Compare selector-oriented manipulation, DOM-shaped documents and parser trees by the APIs a tool actually needs.

Npm Package Weekly Downloads Trend

3 Years

Github Stars Ranking

Stat Detail

Package
Downloads
Stars
Size
Issues
Publish
License
parse5252,786,0033,943387 kB4112 days agoMIT
jsdom165,941,24421,7606.91 MB2446 days agoMIT
cheerio37,258,99130,5521.01 MB8210 months agoMIT
domino2,713,817791821 kB2812 days agoBSD-2-Clause

The output model determines the useful API

cheerio exposes selector-oriented traversal and manipulation over loaded markup. domino provides a server-side document/window-style DOM model. jsdom implements a broader collection of DOM and web-platform APIs for Node. parse5 parses HTML into its tree representation and serializes it.

A parse5 node is not automatically a browser Element with querySelector, and Cheerio's $ collection is not a complete browser window. Select the representation expected by the next stage of the tool.

Parsing is separate from page execution and rendering

Loading or parsing HTML can insert implied document elements and normalize structure. It does not mean a page's scripts have run or the visible layout has been computed.

Domino explicitly focuses on constructing/manipulating documents without running page scripts or downloading external resources. jsdom has separately configured script/resource behavior, but does not implement visual layout/rendering. Even its visual-pretence option changes selected API signals rather than creating a real renderer.

Use an actual rendering environment when pixel layout or browser visual interaction is the requirement. A successful DOM query cannot verify those outcomes.

Check integrations and current runtime requirements

Cheerio wraps parser components rather than being independent of every parser in this list; its selected parse5 dependency is not automatically the independently newest parse5 publication. jsdom has its own parser dependency and precise Node engine range.

Choose selector manipulation for markup transformation, DOM methods for compatible document work, broader window APIs for relevant tests, or parser trees for lower-level HTML tooling. Migration can require changing traversal, serialization, implied-element assumptions and runtime setup, not merely renaming the constructor.

How to Choose: parse5 vs jsdom vs cheerio vs domino

  • parse5:

    Choose HTML parsing and serialization trees when downstream code can work with that representation rather than browser DOM methods.

  • jsdom:

    Choose a broader Node web-platform/window environment when tests or tools need those implemented APIs, while accounting for its limits.

  • cheerio:

    Choose jQuery-style selection and HTML/XML transformation when a full browser-like window is unnecessary.

  • domino:

    Choose a server-side DOM construction/manipulation model when its implemented DOM and selector behavior fit.

README for parse5

parse5

parse5

HTML parser and serializer.

npm install --save parse5

📖 Documentation 📖

Usage

Parse HTML into a document tree and serialize it back to HTML.

import { parse, serialize } from 'parse5';

const document = parse('<p>Hello, world!</p>');
console.log(serialize(document));
// <html><head></head><body><p>Hello, world!</p></body></html>

List of parse5 toolset packages

GitHub

Online playground

Changelog