14.10.1 • Published 2 days ago

happy-dom-without-node v14.10.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 days ago

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.

This package makes it possible to use Happy DOM in an environment without Node.js. Some functionality such as HTTP requests is not supported by this package yet.

As VM is part of Node.js, this package does not support running JavaScript in a sandbox. Javascript will be executed in the global scope.

Module Systems

Installation

npm install happy-dom-without-node

Usage

import { Window } from 'happy-dom-without-node';

const window = new Window({ url: 'https://localhost:8080' });
const document = window.document;

document.body.innerHTML = '<div class="container"></div>';

const container = document.querySelector('.container');
const button = document.createElement('button');

container.appendChild(button);

// Outputs "<div class="container"><button></button></div>"
console.log(document.body.innerHTML);

Contributing

See Contributing Guide.

14.10.1

2 days ago

14.7.1

24 days ago

13.4.1

3 months ago

13.3.8

3 months ago

13.3.5

3 months ago

13.3.4

3 months ago

13.3.1

3 months ago