admin管理员组文章数量:1355063
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?
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?
Share Improve this question edited Mar 14, 2012 at 22:06 Mario asked Mar 14, 2012 at 21:47 MarioMario 2,9421 gold badge27 silver badges38 bronze badges 4- Could you explain why you need this? – JPuge Commented Mar 15, 2012 at 18:38
- It's to test javascript code. – Mario Commented Mar 17, 2012 at 2:30
- 1 I am looking for something similar, here is the reason for me: I want to run it in v8 js engine (controlled by golang bindings to v8), but not necessarily in node. – Helin Wang Commented Jun 2, 2015 at 21:54
- @JPuge Questions like this always turn out to be retarded as the time goes on. The reasons may include: Using DOM in web workers, using DOM in custom native application that runs HTML and Javascript, using javascript to validate some HTML files... – Tomáš Zato Commented Nov 11, 2015 at 13:07
2 Answers
Reset to default 5In 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.
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...
本文标签: DOM implementation in pure javascriptStack Overflow
版权声明:本文标题:DOM implementation in pure javascript? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1743970264a2570623.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论