Fixed for working in webworker

using document instead of window.document was giving the error "document is not defined".
I am using chrome canary 28 (latest)