Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DOM implementation in pure javascript?

Tags:

javascript

dom

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

  • There is env.js, but that requires Rhino.
  • There's jsdom, but that requires Node.

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?

like image 218
Mario Avatar asked Mar 14 '12 21:03

Mario


People also ask

How is DOM used in JavaScript?

The DOM defines a standard for accessing documents: "The W3C Document Object Model (DOM) is a platform and language-neutral interface that allows programs and scripts to dynamically access and update the content, structure, and style of a document."

Is DOM part of JavaScript?

The DOM is not part of the JavaScript language, but is instead a Web API used to build websites. JavaScript can also be used in other contexts. For example, Node. js runs JavaScript programs on a computer, but provides a different set of APIs, and the DOM API is not a core part of the Node.

What is DOM manipulation JavaScript?

DOM manipulation is the interaction of the JavaScript DOM API to modify or change the HTML document. With DOM manipulation, you can create, modify, style, or delete elements without a refresh. It also promotes user interactivity with browsers. You can use different programming languages to manipulate the DOM.


1 Answers

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.

like image 137
Domenic Avatar answered Sep 20 '22 06:09

Domenic