Sjoerd Visscher wrote:
No, a synchronous XMLHttpRequest does not block the running javascript thread.
I'm not sure what you mean by that, actually. It block execution of the script in which the call was made.
But it will therefore also not block the onclick handler
It'll block it in Gecko.
and you'll still see no black background flash.
Did you test this?
The onclick and onmouseup events run in the same thread. Only when this thread is done, you'll see a redraw. The onreadystate event will start a new thread to finish handling the XMLHttpRequest.
There's no new thread started in Gecko.
Firefox and IE do not redraw as long as the javascript code is running.
Actually, that's not true; there are ways to force a redraw while JS is running (eg setting the value of a form input will often do it).
So what I mean with forbidding a redraw is that the 2 events run in the same javascript thread.
All JS in Gecko, as far as this discussion is concerned, runs on a single thread. All events fire on that thread. All painting happens on that thread. There is only one thread in the application as far as page code is concerned.
-Boris
