jsdom

A pure-JavaScript implementation of the WHATWG DOM and HTML standards for Node.js.

Library
npm
v30.1.1
21,692 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
89 /100 Excellent
Development Activity 96
Maintenance 84
Community 76
Maturity 60
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
87 /100 Excellent
Architecture 89
Code Quality 86
Innovation 88
Learning Curve 78

jsdom is a pure-JavaScript implementation of many web standards, most notably the WHATWG DOM and HTML specifications, built to run inside Node.js. It emulates enough of a browser environment to parse HTML into a live document, expose the familiar window and document globals, run scripts, handle events, and fetch subresources, without needing an actual browser or headless Chromium.

It is the DOM engine behind much of the JavaScript testing ecosystem and a workhorse for server-side HTML processing and scraping. You give the JSDOM constructor a string of markup and get back a fully navigable document you can query with standard DOM APIs, manipulate, and serialize back to HTML.

What You Get

  • A JSDOM constructor that parses HTML or XML into a live, spec-compliant window/document pair
  • Standard DOM APIs, including querySelector, events, mutation observers, ranges, and node traversal
  • Configurable script execution, subresource loading, cookies, virtual console, and custom resource loaders
  • Convenience factories such as JSDOM.fromFile() and JSDOM.fromURL() plus serialization back to HTML

Common Use Cases

  • Providing the DOM environment for unit tests run under Jest, Vitest, or Mocha
  • Server-side scraping and extraction of data from real-world HTML pages
  • Rendering, inspecting, or transforming HTML documents in Node.js pipelines

Under The Hood

Architecture - The public surface lives in lib/api.js, whose JSDOM class normalizes the input HTML, transforms user options, builds a window via createWindow (lib/jsdom/browser/Window.js), and parses markup into a document with parseIntoDocument before closing it. The bulk of the implementation is the lib/jsdom/living/ tree, roughly 35 modules mapping to web-standard areas such as nodes, events, xhr, fetch, css, webstorage, range, custom-elements, and mutation-observer, with IDL interfaces generated from Web IDL. Convenience factories (fromFile, fromURL), a VirtualConsole, a loose CookieJar, and a pluggable resource/dispatcher layer round out the design.

Tech Stack - jsdom is written in JavaScript using CommonJS modules and targets modern Node.js (engines ^20.19 || ^22.13 || >=24). It composes a suite of standards-focused dependencies: parse5 for HTML parsing, saxes and xml-name-validator for XML, whatwg-url and whatwg-mimetype for URL/MIME handling, undici for fetch, tough-cookie for cookies, css-tree/@asamuzakjp packages for CSS, and webidl-conversions/decimal.js for type coercion. Interface bindings are generated with webidl2js, and the build is orchestrated with wireit.

Code Quality - The project is mature and rigorously tested. Beyond its own test/api suite run with Mocha, it validates conformance against the shared Web Platform Tests (test/web-platform-tests), a strong signal of standards fidelity. It ships an ESLint flat config, contributor and maintainer guides, and benchmarks. The codebase is large but consistently organized by specification area, and error handling follows DOM semantics (e.g. throwing DOMException on quota or parse violations).

API Design - The developer experience is deliberately browser-like: import jsdom, destructure JSDOM, and pass a markup string to get a working window/document. A single options object exposes advanced behavior (url, runScripts, resources, includeNodeLocations, storageQuota) with safe, performance-minded defaults, and static async factories cover file and URL sources. Named exports (JSDOM, VirtualConsole, CookieJar, ResourceLoader) and thorough README documentation keep the boilerplate minimal for common cases while leaving escape hatches for advanced use.

Used by 200 apps in this directory

JavaScript
88%
GPL 3.0

NodeBB

Community

15,227

Modern Node.js forum software with real-time WebSockets, multi-database support, and a plugin ecosystem — the community platform built for the open web and the Fediverse.

View details
97
Repo Health
78
Technical
70
Dependency
Built with
JavaScript 88%
Go Template 11%
Updated 1 weeks ago
Go
74%
Other

Notifuse

Marketing

2,223

Open-source, self-hosted alternative to Mailchimp, Brevo, and Klaviyo — send newsletters and transactional emails without per-email pricing or vendor lock-in.

View details
81
Repo Health
80
Technical
66
Dependency
Built with
Go 74%
TypeScript 23%
Updated 3 weeks ago
Java
76%
Apache 2.0

Nubase

AI Development · Low Code Platforms

624

Turn AI-written code into real apps — an open-source, self-hostable backend with Database, Auth, Storage, Memory, Functions, Assets, AI Gateway, and cron built for AI coding agents.

View details
68
Repo Health
76
Technical
74
Dependency
Built with
Java 76%
TypeScript 21%
Updated 1 months ago
TypeScript
95%
MIT

OmniRoute

AI Agents

70,824

A free, open-source AI gateway connecting Claude Code, Codex, Cursor, Cline, and Copilot to 237 AI providers (90+ free) through one endpoint, with automatic fallback and token-compression to stretch free-tier limits further.

View details
86
Repo Health
70
Technical
71
Dependency
Built with
TypeScript 95%
Updated 1 weeks ago
Ruby
62%
MIT

OnetimeSecret

Security

2,947

Generate self-destructing single-use links to share passwords and sensitive data without leaving traces in inboxes or chat logs.

View details
92
Repo Health
81
Technical
72
Dependency
Built with
Ruby 62%
TypeScript 25%
Updated 1 weeks ago
TypeScript
71%
Apache 2.0

open-design

Design Tools

98,365

Local-first, open-source Claude Design alternative that turns your existing coding agent CLI into a full agentic design studio — with 259+ skills, 142+ design systems, and sandboxed artifact delivery across web, desktop, and mobile surfaces.

View details
85
Repo Health
86
Technical
72
Dependency
Built with
TypeScript 71%
HTML 22%
Updated 1 weeks ago
TypeScript
97%
GPL 3.0

OpenKnowledge

Code Editors · Knowledge Management · Note Taking

4,337

A beautiful, local-first markdown IDE that turns any git repo into a live collaborative workspace for humans and AI coding agents like Claude, Codex, and OpenCode.

View details
79
Repo Health
89
Technical
64
Dependency
Built with
TypeScript 97%
Updated 1 weeks ago
TypeScript
58%
MIT

open-notebook

AI Assistants · Note Taking

39,569

A privacy-first, self-hosted AI research notebook with 18+ model providers, multi-speaker podcast generation, and full REST API—your open-source alternative to Google Notebook LM.

View details
90
Repo Health
84
Technical
71
Dependency
Built with
TypeScript 58%
Python 39%
Updated 1 weeks ago
Python
100%
Other

OpenBB

Analytics · Databases · Invoicing Finance

73,553

The AI Workspace for Finance: Connect Data, Run AI Agents, Build Analytics

View details
77
Repo Health
80
Technical
67
Dependency
Built with
Python 100%
Updated 1 weeks ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers