DOM在纯JavaScript中实现? [英] DOM implementation in pure javascript?

查看:81
本文介绍了DOM在纯JavaScript中实现?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有实现或模拟的DOM是纯粹的JavaScript?




  • 有env.js,但这需要Rhino。

  • 有jsdom,但这需要Node。



任何JavaScript解释器,如v8,不绑定到任何特定的解释器或引擎?也就是说,JS中是否有任何DOM实现,没有任何设置或垫片可以放在javascript解释器中,只能运行?

解决方案

除了您列出的内容之外,我听说过有关 dom.js 的好消息。它需要有限的ES6功能,例如 const WeakMap 代理,所以它将在V8和SpiderMonkey(Rhino)中工作,但不能使用JavaScriptCore,Chakra或其他。


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?

解决方案

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.

这篇关于DOM在纯JavaScript中实现?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆