How to incoparate or implement a DOM API to v8?

I am writing a server application that is able to manipulate the DOM before it is served to the client.
I am using C++ and Google's v8 as a javascript engine but I don't see any DOM API in v8.
Is there an open source implementation for doing DOM manipulation on HTML?
If not how would you implement one?


The DOM is created and linked to the V8 engine in Chrome. The V8 sources know nothing about the browser DOM. The quickest way to get this working for you would be to try to extract the parts of Chrome (Chromium, really) that load HTML into a structure, and the parts that link the DOM and DOM methods into V8. It's probably not as bad as you think. If anything, Google produces pretty clean C++, as far as I can tell from looking at the V8 source code. It's probably not as bad as you think.


Have you checked out CplusplusDOM? (which has been created after your question was asked)

The C++ DOM API is a library for writing Web applications in C++ over NPAPI/Pepper using the Web IDL C++ binding for accessing DOM objects inside the Web browser.


正如你已经有(根据我的理解)你自己在C ++中的dom实现,并且只需要JS dom绑定,我相信在JS映射的低级JS函数中实现其大部分将更容易,

链接地址: http://www.djcxy.com/p/42906.html

上一篇: Selenium:无法连接到远程服务器

下一篇: 如何增加或实现一个DOM API到v8?