I am developing a multi-platform game/visualization framework that uses JavaScript for scripting purposes. The current Flash-based implementation, intended for use in browsers, injects framework-level scripts into the host page and executes the game scripts in that environment, marshaling calls/objects in and out of the SWF object as necessary.
This solution is working nicely and will allow alternate native (out-of-browser) framework implementations to use a dedicated JS engine (such as V8) as the scripting e开发者_运维百科nvironment and run the scripts unaltered.
The framework uses a custom hierarchical document object model, used declaratively in XML. I'd now like to extend the model to allow runtime modification of the hierarchy. Rather than designing a new solution from scratch for tree operations and event binding, I'm looking into implementing or harnessing jQuery for this purpose.
For those of you familiar with behind-the-scenes jQuery, how extensible is it when it comes to working with alternate object models? Is it baked onto the HTML DOM, or can I wiggle my way into its internals and add support for my DOM?
Thanks for any insights.
jQuery (being built on Javascript) is built around the W3C's DOM (which presents itself as an extension built into the implementation of ECMAScript). The API for this is governed by the W3C's DOM specification. Web Browsers implement support for the DOM by exposing the API to their specific Javascript host, be it Chakra, V8, Tracemonkey etc.
From what I can see, if you can implement (or partially implement) the DOM specification which Javascript and jQuery (and other frameworks) respond to, there should be no reason why jQuery cannot be used in the way you want.
That seems like a lot of work though...
精彩评论