[Helma-user] Server-side DOM
Chris Zumbrunn
chris at zumbrunn.com
Wed Jul 11 13:41:04 CEST 2007
On Jul 11, 2007, at 6:12 , Maksim Lin for technical support mailling
lists wrote:
> I came across this on John Resigs blog and it looks like at the very
> least it would be useful for doing testing of helma apps within helma
> along the lines of whats currently provided in Jala...
>
> http://ejohn.org/blog/bringing-the-browser-to-the-server/
I've played with it a bit yesterday. One "problem" when using it
inside of Helma is that is pollutes the global namespace with the
browser DOM objects and properties (to avoid that, it would need to
be run inside a separate js scope). Also, since the window.onload
event fires in its own thread after the document has been loaded/
updated, the DOM processing happens asynchronous from the request
that invoked it.
Anyway, it works :-) You can drop the unmodified env.js and
jquery.js files into the Global directory of a Helma app (or load
them dynamically using app.addRepository()). The only thing you need
to do is make the global vars sticky using the following
defineLibraryScope calls:
defineLibraryScope('window');
defineLibraryScope('navigator');
defineLibraryScope('location');
defineLibraryScope('setTimeout');
defineLibraryScope('setInterval');
defineLibraryScope('clearInterval');
defineLibraryScope('addEventListener');
defineLibraryScope('removeEventListener');
defineLibraryScope('dispatchEvent');
defineLibraryScope('DOMDocument');
defineLibraryScope('DOMNode');
defineLibraryScope('DOMNodeList');
defineLibraryScope('DOMElement');
defineLibraryScope('XMLHttpRequest');
defineLibraryScope('document');
Chris
More information about the Helma-user
mailing list