Happy DOM

Happy DOM is a JavaScript implementation of a web browser without its graph...

README

Happy DOM Logo


About


Happy DOM is a JavaScript implementation of a web browser without its graphical user interface. It includes many web standards from WHATWG DOM and HTML.

The goal of Happy DOM is to emulate enough of a web browser to be useful for testing, scraping web sites and server-side rendering.

Happy DOM focuses heavily on performance and can be used as an alternative to JSDOM.





DOM Features


- Custom Elements (Web Components)

- Shadow Root (Shadow DOM)

- Declarative Shadow DOM

- Mutation Observer

- Tree Walker

- Fetch
  

And much more..



Works With






- Vue



Packages


This repository is a _Monorepo_. Each package lives under `packages/`.


This package contains the core functionality of Happy DOM.



This package makes it possible to use Happy DOM with Jest.



A utility that registers Happy DOM globally, which makes it possible to use Happy DOM for testing in a Node environment.



This package has been deprecated.

Happy DOM now supports Declarative Shadow DOM which can be used for server-side rendering of web components.



Performance


OperationJSDOMHappy
----------------------------------------------------
Import33345
Parse25626
Serialize658
Render21419
querySelectorAll('tagname')4.90.7
querySelectorAll('.class')6.43.7
querySelectorAll('[attribute]')4.01.7
querySelectorAll('[class~="name"]')5.52.9
querySelectorAll(':nth-child(2n+1)')10.43.8


Contributing