Home

jsdom

jsdom is a JavaScript implementation of the WHATWG DOM and HTML standards designed to run in the Node.js environment. It provides a browser-like DOM API by simulating a window and a document, allowing developers to parse HTML and manipulate the DOM without a real browser. A typical usage involves creating a JSDOM instance from an HTML string or a file, after which code can interact with document, window, and related APIs as if running in a web page.

The library aims to offer a practical, browser-compatible environment for server-side JavaScript. It exposes standard DOM

Limitations include the absence of actual CSS rendering and visual layout, no real browser rendering or user

jsdom is widely used for testing, server-side rendering, and automation tasks in Node.js. It is an open-source

features
such
as
document,
window,
querySelector,
addEventListener,
and
element
APIs,
along
with
common
Web
APIs
like
localStorage
and
cookies.
It
can
execute
scripts
in
the
DOM
when
configured
with
appropriate
options
and
can
load
external
resources
via
a
resource
loader,
though
with
notable
limitations
compared
to
a
real
browser.
While
substantial,
its
implementation
focuses
on
DOM
manipulation
and
HTML
parsing
rather
than
rendering
or
layout.
interaction,
and
incomplete
support
for
certain
browser-specific
features.
Performance
characteristics
and
security
models
differ
from
those
of
real
browsers,
and
some
web
platform
APIs
may
be
partially
supported
or
missing.
project
distributed
via
npm
and
maintained
by
a
community
of
contributors,
serving
as
a
practical
substitute
for
DOM
manipulation
in
non-browser
environments
and
complementing
testing
frameworks
and
build
workflows.