Domino provides a lightweight, server-side implementation of the Document Object Model (DOM) for Node.js, currently at version 2.1.7. Its primary goal is to enable server-side rendering and manipulation of HTML structures without the overhead of a full browser engine. It prioritizes performance and simplicity over strict compliance with the latest DOM specifications or script execution. Domino adheres to DOM Level 4, meaning certain modern browser APIs and behaviors (like Attributes inheriting Node) are not present. It explicitly does not execute scripts or download external resources, making it unsuitable for scraping pages that rely heavily on client-side JavaScript. The library offers both a standard `createWindow` / `createDocument` API and an incremental HTML parser for streaming input. It differentiates itself from alternatives like `jsdom` by not aiming to run untrusted code, avoiding proxy facades and leading to a more performant internal structure, especially for tree modification if `Node#childNodes` is avoided.
npm install dominoVerified import paths — ran on the pinned version, not inferred.
Demonstrates creating a DOM window/document, querying elements, verifying element types, and basic DOM manipulation.
To use array methods, convert `element.attributes` to an array first: `Array.from(element.attributes).map(...)` or `[...element.attributes].forEach(...)`.
Do not rely on client-side script execution or external resource loading. For dynamic content, manipulate the DOM programmatically. For resource fetching, handle it externally before injecting content.
Consult MDN's DOM Level 4 documentation for API compatibility. If you require full HTML5 compliance or newer DOM APIs, consider libraries like `jsdom`.
Refactor DOM modification logic to avoid repeated access to `Node#childNodes` if performance is critical for large trees or frequent changes.
Convert `element.attributes` to an array before using array methods: `Array.from(element.attributes).map(...)` or `[...element.attributes].forEach(...)`.
Always create a `domino` `window` or `document` instance explicitly using `createWindow()` or `createDocument()`, then access the document via `window.document` or the returned `document` object.
Client-side scripts are not supported. Any dynamic behavior must be implemented programmatically using Domino's DOM manipulation APIs in your Node.js code, or by pre-rendering the final HTML.
No dependency data recorded yet.