Security News
Opengrep Emerges as Open Source Alternative Amid Semgrep Licensing Controversy
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
domino-modernized
Advanced tools
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.
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.
Note that because domino does not use proxies,
Element.attributes
is not a true JavaScript array; it is an object
with a length
property and an item(n)
accessor method. See
github issue #27 for
further discussion.
Domino provides support for querySelector()
, querySelectorAll()
, and matches()
backed by the Zest selector engine.
Domino supports the DOM level 4 API, and thus API documentation can be found on standard reference sites. For example, you could start from MDN's documentation for Document and Node.
The only exception is the initial creation of a document:
var domino = require('domino');
var Element = domino.impl.Element; // etc
var window = domino.createWindow('<h1>Hello world</h1>', 'http://example.com');
var document = window.document;
// alternatively: document = domino.createDocument(htmlString, true)
var h1 = document.querySelector('h1');
console.log(h1.innerHTML);
console.log(h1 instanceof Element);
If you want a more standards-compliant way to create a Document
, you can
also use DOMImplementation:
var domino = require('domino');
var domimpl = domino.createDOMImplementation();
var doc = domimpl.createHTMLDocument();
By default many domino methods will be stored in writable properties, to allow polyfills (as browsers do). You can lock down the implementation if desired as follows:
global.__domino_frozen__ = true; // Must precede any `require('domino')`
var domino = require('domino');
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:
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.
FAQs
Server-side DOM implementation based on Mozilla's dom.js
We found that domino-modernized demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.