Re: [AnimationRequestFrame] Sample all animations operation and cancelRequestAnimationFrame specification updated

On Tue, May 3, 2011 at 7:32 PM, Boris Zbarsky <bzbarsky@mit.edu> wrote:
> On 5/3/11 10:15 PM, James Robinson wrote:
>>
>> - Callbacks registered outside of the "sample all animation" operation
>> should immediately be eligible to run.
>> - Callbacks registered during the "sample all animations" operation
>> should run the next time the browser samples animations.
>
> Agreed on these.
>
>> - A callback should never run after it has been cancelled, regardless of
>> when it gets cancelled.
>
> This does add another source of ordering dependencies on callbacks (which
> can try to cancel each other).  Disallowing cancellation of callbacks that
> are in the list copy would avoid that, though I agree that behavior might
> surprise developers.
>
> I'd love some more opinions here if people have any.
>
>> I think this is the least surprising behavior for developers.  In the
>> spec this is specified using a copy of the callback list and a
>> cancellation flag, but implementations can of course do something
>> simpler that has the same behavior (such as immediately remove the
>> callback from whatever list it is in).  The copy stuff will likely be
>> necessary when we add the element visibility checks in so I've left it
>> specified that way for now.
>
> The copy stuff also makes it much simpler to handle your second bullet
> point; it Just Works with nothing else needing to be said.

Note that there are quite trivial ways of iterating over a list while
still allowing items to be removed from the list. Without copying the
whole list every time.

I would expect all browsers to have solved this problem already as the
DOM Events spec require it.

/ Jonas

Received on Wednesday, 4 May 2011 19:07:06 UTC