Is JavaScript single threaded? If not, how do I get synchronized access to shared data?

前端 未结 7 1918
执笔经年
执笔经年 2020-12-17 01:12

I have a web page with DIVs with a mouseover handler that is intended to show a pop-up information bubble. I don\'t want more than one info bubble

7条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-17 01:30

    It is single threaded in browsers. Event handlers are running asynchroniously in one thread, non blocking doesn't allways mean multithreaded. Is one of your divs a child of the other? Because events spread like bubbles in the dom tree from child to parent.

提交回复
热议问题