Mario
Mario

Reputation: 2942

DOM implementation in pure javascript?

Is there an implementation or emulation of the DOM which is purely javascript?

Is there a solution that works in most any javascript interpreter, such as v8, without being tied to any particular interpreter or engine? That is, is there any DOM implementation in JS that without any set up or shims can be dropped into a javascript interpreter and just run?

Upvotes: 14

Views: 3910

Answers (2)

Domenic
Domenic

Reputation: 112817

In addition to the ones you have listed, I have heard good things about dom.js. It requires limited ES6 features such as const, WeakMap, and Proxy, so it will work in V8 and SpiderMonkey (Rhino) but not JavaScriptCore, Chakra, or others.

Upvotes: 5

Chris Jaynes
Chris Jaynes

Reputation: 2907

It's hard to guess at exactly what you're trying to do, here, but I'll take a stab at it, just to keep the conversation going:

  • If you're trying to manipulate a DOM from within a browser, can't you just use Jquery?
  • If you're trying to get a "headless browser", I'd check out PhantomJS.

I guess it's hard to imagine how you'd even run Javascript code without a browser, or Rhino, or Node, or PhantomJS, or some other JS interpreter environment...

Upvotes: 1

Related Questions