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

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.
DOM Features
- Custom Elements (Web Components)
- Shadow Root (Shadow DOM)
- Declarative Shadow DOM
- Mutation Observer
- Tree Walker
- Fetch
And much more..
Works With
- React
- Angular
- Vue
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
| Operation | JSDOM | Happy |
|---|---|---|
| ------------------------------------ | ------- | --------- |
| Import | 333 | 45 |
| Parse | 256 | 26 |
| Serialize | 65 | 8 |
| Render | 214 | 19 |
| querySelectorAll('tagname') | 4.9 | 0.7 |
| querySelectorAll('.class') | 6.4 | 3.7 |
| querySelectorAll('[attribute]') | 4.0 | 1.7 |
| querySelectorAll('[class~="name"]') | 5.5 | 2.9 |
| querySelectorAll(':nth-child(2n+1)') | 10.4 | 3.8 |
探客时代
