Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8351671
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T08:42:30+00:00 2026-06-09T08:42:30+00:00

I know that web workers cant access the dom directly. But would it be

  • 0

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 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T08:42:32+00:00Added an answer on June 9, 2026 at 8:42 am

    I don’t see any reason why you can’t do this, but this could lead to issues when you are trying to manipulate the same element in the worker and in the main js code at the same time.

    You would need to add some mutex locking to your code.

    Sorry scratch the above…


    Workers do NOT have access to:

    The DOM (it’s not thread-safe)
    The window object
    The document object
    The parent object

    Source

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know web workers work as a separate thread than the UI thread but
I know that can co-exists with web form no problem as Hanselman mention here
I know that when a war file is created of my web application, i
As a web developer I am using PHP and I know that I have
as you all know that if we use flash object in web page in
I am using SQL Server for my web application. How will I know that
web.config: <customErrors mode=On defaultRedirect=~/Foo.aspx /> When Foo.aspx.cs is running, how can I know that
Does anybody know a good web framework that includes an ORM mapper and allows
1) I know there are lots of web sites that describe in what order
Does anybody know where I can get a free web crawler that actually works

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.