Limited DOM in Web Workers

Hi,

I have a proposal of sorts, regarding Workers. As we all know, there's no
access to the DOM from within a Web Worker. While this is ideal for security
purposes, I can't help but think a restricted subset of the available DOM
manipulation methods would be incredibly useful.

I'm not talking about allowing Worker's to manipulate the main DOM tree of
the page, but rather, exposing DOMParser, and XMLHttpRequest.responseXML,
and a few other objects to workers, to allow the manipulation of DOM trees
which are never actually rendered to the page.

This would allow developers to parse and manipulate XML in workers, freeing
the main thread of a page to perform other tasks.

A possible counter argument, may be "Why not just use JSON instead?", and
while I agree that JSON is the easiest method of serialising and parsing
objects, sometimes developers must work with data from a source which
only provides XML.


An example of a use-case, I'd like to hack on the Strope.js XMPP
implementation to allow it to run in a worker thread, currently this is
impossible, without writing my own XML parser, which would undoubtedly
be slower than the native DOMParser)

Any thoughts?


Regards,
Jack Coulter

Received on Friday, 7 January 2011 22:57:52 UTC