A DOM implementation in CoffeeScript, full CSS3 support.

Intended for use in NodeJS.

I haven't checked the actual DOM compliance, but everything you need is there:

  • Full CSS3 support via NWMatcher.
  • A very tiny HTML parser.
  • DOM-compliant event binding and triggering (bubbling, cancelling, etc).
  • Coming soon: (optional) Mutation Events.

This is not a fork of jsdom.

It assumes the document is going to act like it would in a browser (e.g. it automatically gets a head and body).

No attempt has been made to support XML or Xpath or anything exotic.


document = require('jldom').createDocument()

document.body.innerHTML = "<div>Hello, World.</div>"

    === "<html><head/><body><div>Hello, World.</div></body></html>"

    === "<div>Hello, World.</div>"

I built this to generate server-side HTML from a NodeJS application. Benchmarks reveal that this is a waste of time. I currently use it to unit test other javascript code that needs a reasonably well-behaved DOM to interact with.


npm install jldom


git clone git://github.com/jldailey/jldom.git
cd jldom