{"id":13527457,"url":"https://github.com/fgnass/domino","last_synced_at":"2025-07-31T09:41:10.352Z","repository":{"id":2249369,"uuid":"3204278","full_name":"fgnass/domino","owner":"fgnass","description":"Server-side DOM implementation based on Mozilla's dom.js","archived":false,"fork":false,"pushed_at":"2024-05-07T19:05:53.000Z","size":1980,"stargazers_count":779,"open_issues_count":37,"forks_count":122,"subscribers_count":21,"default_branch":"master","last_synced_at":"2025-07-02T11:47:01.132Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fgnass.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2012-01-17T23:19:38.000Z","updated_at":"2025-07-01T10:48:56.000Z","dependencies_parsed_at":"2024-05-30T06:44:48.662Z","dependency_job_id":null,"html_url":"https://github.com/fgnass/domino","commit_stats":{"total_commits":448,"total_committers":27,"mean_commits":16.59259259259259,"dds":0.3058035714285714,"last_synced_commit":"12a5f67136a0ac10e3fa1649b8787ba3b309e9a7"},"previous_names":[],"tags_count":33,"template":false,"template_full_name":null,"purl":"pkg:github/fgnass/domino","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fgnass%2Fdomino","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fgnass%2Fdomino/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fgnass%2Fdomino/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fgnass%2Fdomino/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fgnass","download_url":"https://codeload.github.com/fgnass/domino/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fgnass%2Fdomino/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264667045,"owners_count":23646581,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T06:01:48.410Z","updated_at":"2025-07-31T09:41:10.304Z","avatar_url":"https://github.com/fgnass.png","language":"JavaScript","funding_links":[],"categories":["Repository","JavaScript"],"sub_categories":["Server-side DOM"],"readme":"# Server-side DOM implementation based on Mozilla's dom.js\n\n[![Build Status][1]][2] [![dependency status][3]][4] [![dev dependency status][5]][6]\n\nAs the name might suggest, domino's goal is to provide a \u003cb\u003eDOM in No\u003c/b\u003ede.\n\nIn contrast to the original [dom.js](https://github.com/andreasgal/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](https://github.com/fgnass/dombench).\n\nDomino currently doesn't use any harmony/ES6 features like proxies or WeakMaps and therefore also runs in older Node versions.\n\n## Speed over Compliance\n\nDomino is intended for _building_ pages rather than scraping them. Hence Domino doesn't execute scripts nor does it download external resources.\n\nAlso Domino doesn't generally implement properties which have been deprecated in HTML5.\n\nDomino sticks to [DOM level 4](http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#interface-attr), which means that Attributes do not inherit the Node interface.\n\n\u003cb\u003eNote that\u003c/b\u003e because domino does not use proxies,\n`Element.attributes` is not a true JavaScript array; it is an object\nwith a `length` property and an `item(n)` accessor method.  See\n[github issue #27](https://github.com/fgnass/domino/issues/27) for\nfurther discussion.  It does however implement direct indexed accessors\n(`element.attributes[i]`) and is live.\n\n\n\n## CSS Selector Support\n\nDomino provides support for `querySelector()`, `querySelectorAll()`, and `matches()` backed by the [Zest](https://github.com/chjj/zest) selector engine.\n\n## Optimization\n\nDomino represents the DOM tree structure in the same way Webkit and\nother browser-based implementations do: as a linked list of children\nwhich is converted to an array-based representation iff the\n`Node#childNodes` accessor is used.  You will get the best performance\nfrom tree modification code (inserting and removing children) if you\navoid the use of `Node#childNodes` and traverse the tree using\n`Node#firstChild`/`Node#nextSibling` (or\n`Node#lastChild`/`Node#previousSibling`) or `querySelector()`/etc.\n\n## Usage\n\nDomino supports the DOM level 4 API, and thus API documentation can be\nfound on standard reference sites.  For example, you could start from\nMDN's documentation for\n[Document](https://developer.mozilla.org/en-US/docs/Web/API/Document) and\n[Node](https://developer.mozilla.org/en-US/docs/Web/API/Node).\n\nThe only exception is the initial creation of a document:\n```javascript\nvar domino = require('domino');\nvar Element = domino.impl.Element; // etc\n\nvar window = domino.createWindow('\u003ch1\u003eHello world\u003c/h1\u003e', 'http://example.com');\nvar document = window.document;\n\n// alternatively: document = domino.createDocument(htmlString, true)\n\nvar h1 = document.querySelector('h1');\nconsole.log(h1.innerHTML);\nconsole.log(h1 instanceof Element);\n```\n\nThere is also an incremental parser available, if you need to interleave\nparsing with other processing:\n```javascript\nvar domino = require('domino');\n\nvar pauseAfter = function(ms) {\n  var start = Date.now();\n  return function() { return (Date.now() - start) \u003e= ms; };\n};\n\nvar incrParser = domino.createIncrementalHTMLParser();\nincrParser.write('\u003cp\u003ehello\u003c');\nincrParser.write('b\u003e\u0026am');\nincrParser.process(pauseAfter(1/*ms*/)); // can interleave processing\nincrParser.write('p;');\n// ...etc...\nincrParser.end(); // when done writing the document\n\nwhile (incrParser.process(pauseAfter(10/*ms*/))) {\n  // ...do other housekeeping...\n}\n\nconsole.log(incrParser.document().outerHTML);\n```\n\nIf you want a more standards-compliant way to create a `Document`, you can\nalso use [DOMImplementation](https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation):\n```javascript\nvar domino = require('domino');\nvar domimpl = domino.createDOMImplementation();\nvar doc = domimpl.createHTMLDocument();\n```\n\nBy default many domino methods will be stored in writable properties, to\nallow polyfills (as browsers do).  You can lock down the implementation\nif desired as follows:\n```javascript\nglobal.__domino_frozen__ = true; // Must precede any `require('domino')`\nvar domino = require('domino');\n```\n\n## Tests\n\nDomino includes test from the [W3C DOM Conformance Suites](http://www.w3.org/DOM/Test/)\nas well as tests from [HTML Working Group](http://www.w3.org/html/wg/wiki/Testing).\n\nThe tests can be run via `npm test` or directly though the [Mocha](http://mochajs.org/) command line:\n\n![Screenshot](http://fgnass.github.com/images/domino.png)\n\n## License and Credits\n\nThe majority of the code was originally written by [Andreas Gal](https://github.com/andreasgal/) and [David Flanagan](https://github.com/davidflanagan) as part of the [dom.js](https://github.com/andreasgal/dom.js) project. Please refer to the included LICENSE file for the original copyright notice and disclaimer.\n\n[Felix Gnass](https://github.com/fgnass/) extracted the code and turned\nit into a stand-alone npm package.\n\nThe code has been maintained since 2013 by [C. Scott Ananian](https://github.com/cscott/) on behalf of the Wikimedia Foundation, which uses it in its\n[Parsoid](https://www.mediawiki.org/wiki/Parsoid) project.  A large number\nof improvements have been made, mostly focusing on correctness,\nperformance, and (to a lesser extent) completeness of the implementation.\n\n[1]: https://travis-ci.org/fgnass/domino.svg\n[2]: https://travis-ci.org/fgnass/domino\n[3]: https://david-dm.org/fgnass/domino.svg\n[4]: https://david-dm.org/fgnass/domino\n[5]: https://david-dm.org/fgnass/domino/dev-status.svg\n[6]: https://david-dm.org/fgnass/domino#info=devDependencies\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffgnass%2Fdomino","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffgnass%2Fdomino","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffgnass%2Fdomino/lists"}