# capricorn86/happy-dom

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/capricorn86-happy-dom).**

_How this analysis was created: the description and tags below were written by an AI model that read this project's README and public documentation pages; stars, license and language come straight from the GitHub API. The model does not read the source code._

4,532 stars · 299 forks · TypeScript · MIT

## Links

- GitHub: https://github.com/capricorn86/happy-dom
- awesome-repositories: https://awesome-repositories.com/repository/capricorn86-happy-dom.md

## Topics

`angular` `browser` `bun` `dom` `hacktoberfest` `hacktoberfest2025` `html` `javascript` `jest` `lit-element` `lit-html` `nodejs` `react` `svelte` `testing-library` `typescript` `vitest` `vue` `web-components` `whatwg`

## Description

happy-dom is a JavaScript-based headless browser simulation and virtual DOM engine. It implements the Document Object Model and Web APIs to execute frontend code and run tests within non-browser environments such as Node.js.

The project provides a programmatic interface for creating and testing custom elements and shadow DOM structures. It supports stateful page instance management to simulate multiple concurrent browsing sessions and includes a programmable clock to synchronize asynchronous operations.

The system covers a broad range of browser simulation capabilities, including DOM manipulation and mutation monitoring, network request execution, and the management of window settings and viewport dimensions. It also allows for the injection of browser-standard globals into the execution context.

## Tags

### Web Development

- [DOM Simulations](https://awesome-repositories.com/f/web-development/dom-simulations.md) — Implements a complete Document Object Model using JavaScript to simulate browser behavior without a graphical interface.
- [Simulated Browser Environments](https://awesome-repositories.com/f/web-development/headless-browser-emulation/simulated-browser-environments.md) — Provides a JavaScript-based headless browser simulation to execute frontend code in non-browser environments.
- [DOM Mutation Observation](https://awesome-repositories.com/f/web-development/dom-mutation-observation.md) — Implements MutationObserver to track and react to structural changes in the virtual DOM.
- [HTML DOM Manipulators](https://awesome-repositories.com/f/web-development/html-dom-manipulators.md) — Provides a full suite of tools for creating, appending, and querying nodes within a virtual document. ([source](https://github.com/capricorn86/happy-dom/wiki/Getting-started))
- [Shadow DOM Encapsulation](https://awesome-repositories.com/f/web-development/component-based-architectures/component-based-architectures/ui-component-abstractions/shadow-dom-encapsulation.md) — Supports isolated document fragments to ensure styles and elements remain encapsulated within custom elements.
- [Independent Instance Management](https://awesome-repositories.com/f/web-development/independent-instance-management.md) — Maintains independent window and document states to simulate multiple concurrent browsing sessions.
- [Page Lifecycle Controls](https://awesome-repositories.com/f/web-development/page-lifecycle-controls.md) — Provides programmatic control over page lifecycles, including waiting for or aborting asynchronous operations. ([source](https://github.com/capricorn86/happy-dom/wiki/Getting-started))
- [Web Components](https://awesome-repositories.com/f/web-development/web-components.md) — Supports the creation and testing of custom elements and declarative shadow DOM. ([source](https://github.com/capricorn86/happy-dom#readme))

### Development Tools & Productivity

- [Virtual Browser Environments](https://awesome-repositories.com/f/development-tools-productivity/virtual-browser-environments.md) — Creates a virtual DOM and browser APIs in Node.js to test web applications without a graphical interface. ([source](https://github.com/capricorn86/happy-dom#readme))
- [Asynchronous Simulation Workflows](https://awesome-repositories.com/f/development-tools-productivity/workflow-automations/multi-page-browser-workflow-automators/asynchronous-simulation-workflows.md) — Simulates network requests and page lifecycles to test how applications handle timing and external data.

### Programming Languages & Runtimes

- [Node.js DOM Implementations](https://awesome-repositories.com/f/programming-languages-runtimes/node-js-dom-implementations.md) — Implements a virtual Document Object Model and Web APIs specifically designed to run within Node.js.

### Software Engineering & Architecture

- [Global Window Injections](https://awesome-repositories.com/f/software-engineering-architecture/application-lifecycle-management/configuration-management/environment-variable-management/environment-variable-injection/global-window-injections.md) — Injects browser-standard globals like window and document into Node.js for seamless test execution.
- [Asynchronous Control Flow](https://awesome-repositories.com/f/software-engineering-architecture/asynchronous-control-flow.md) — Provides a programmable clock to synchronize asynchronous operations and timers during tests.

### User Interface & Experience

- [Virtual DOM Testing](https://awesome-repositories.com/f/user-interface-experience/dom-manipulators/virtual-dom-testing.md) — Enables creating and modifying virtual HTML elements to verify UI responses to programmatic changes.
- [DOM Observers](https://awesome-repositories.com/f/user-interface-experience/dom-observers.md) — Utilizes observers to monitor and react to structural changes within the simulated DOM. ([source](https://github.com/capricorn86/happy-dom/blob/master/README.md))
- [Virtual DOM Implementations](https://awesome-repositories.com/f/user-interface-experience/virtual-dom-implementations.md) — Provides a virtual DOM engine for manipulating HTML elements and monitoring mutations without a real browser.

### Testing & Quality Assurance

- [Browser Page Management](https://awesome-repositories.com/f/testing-quality-assurance/general-testing-utilities/test-utilities-assertions/browser-ui-interaction/browser-environment-emulation/browser-page-management.md) — Manages multiple page instances and navigation between URLs to simulate complex user browsing sessions. ([source](https://github.com/capricorn86/happy-dom/wiki/Getting-started))
- [Web Components](https://awesome-repositories.com/f/testing-quality-assurance/software-testing/component-testing/web-components.md) — Provides a simulated environment for building and testing custom elements and shadow DOM structures.
- [Viewport and Timer Control](https://awesome-repositories.com/f/testing-quality-assurance/software-testing/testing-frameworks/test-frameworks/browser-and-ui-testing/browser-automation-frameworks/browser-automation-testing/viewport-and-timer-control.md) — Allows programmatic adjustment of viewport dimensions and timer execution during active tests. ([source](https://github.com/capricorn86/happy-dom/wiki/Setup-as-Test-Environment))
