Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 6fc76f825c
Fetching contributors…

Cannot retrieve contributors at this time

47 lines (26 sloc) 2.342 kb

Server-side DOM implementation based on Mozilla's dom.js

Build Status

As the name might suggest, domino's goal is to provide a DOM in Node.

In contrast to the original dom.js project, domino was not designed to run untrusted code. Hence it doesn't have to hide its internals behind a proxy facade which makes the code not only simpler, but also more performant.

Domino currently doesn't use any harmony features like proxies or WeakMaps and therefore also runs in older Node versions.

Speed over Compliance

Domino is intended for building pages rather than scraping them. Hence Domino doesn't execute scripts nor does it download external resources.

Also Domino doesn't implement any properties which have been deprecated in HTML5.

Domino sticks to the DOM level 4 working draft, which means that Attributes do not inherit the Node interface. Also Element.attributes returns a read-only array instead of a NamedNodeMap.

CSS Selector Support

Domino provides support for querySelector() and querySelectorAll() backed by the Zest selector engine.

Usage

var domino = require('domino');

var window = domino.createWindow('<h1>Hello world</h1>');
var document = window.document;

var h1 = document.querySelector('h1');
console.log(h1.innerHTML);

Tests

Domino includes test from the W3C DOM Conformance Suites as well as tests from HTML Working Group.

The tests can be run via npm test or directly though the Mocha command line:

Screenshot

License and Credits

The majority of the code was written by Andreas Gal and David Flanagan as part of the dom.js project. Please refer to the included LICENSE file for the original copyright notice and disclaimer.

Jump to Line
Something went wrong with that request. Please try again.