Passing the document object to a web worker

Viewed 8195

I know that web workers cant access the dom directly. But would it be a bad idea to do something like this:

var doc = $(document);

var worker = new Worker("worker.js");

worker.postMessage({ cmd: 'doDomStuff', data: doc });

Do you see any downsides with this peice of code?

Any tips/comments are much appreciated.

update: Just to be clear: I only want to getdata from the DOM, not set any new values or manipulate the DOM in any way.

1 Answers
Related