Re: Proposal for mousewheel events

> Boris Zbarsky wrote:
>> Sjoerd Visscher wrote:
>>> I just checked and this is just like onmouseup and onclick, there is 
>>> no redraw between those events in Firefox and IE.
>>
>> It depends on what you do between them, actually.
>>
>>> F.e. if you make the body background black in onmouseup, then start a 
>>> calculation in onclick that takes a while, and at the end set the 
>>> background back to white, you'll never see a black background.
>>
>> On the other hand, if you start a synchronous XMLHttpRequest in 
>> onmouseup after setting the background, what happens?  Does the 
>> browser not draw at all until the XMLHttpRequest finishes?  (It's 
>> actually possible that Gecko does that; but we're working on fixing 
>> those cases.)

Let me try this again. (I got synchronous and asynchronous confused, 
because synchronous sounds to me like things at the same time, while in 
this case it means coordinated time.)

So, an *asynchronous* XMLHttpRequest does not block the running javascript
thread. But it will therefore also not block the onclick handler, and
you'll still see no black background flash. 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.

But a *synchronous* call does block the running javascript thread, and 
no redraws happen in between. I don't think you can simply "fix" this, 
because you'll break the single-threadedness of javascript.

Firefox and IE do not redraw as long as the javascript code is running.
So what I mean with forbidding a redraw is that the 2 events run in the
same javascript thread.

-- 
Sjoerd Visscher
http://w3future.com/weblog/

Received on Monday, 10 April 2006 21:48:06 UTC