On 10/06/2015 12:00, Njaal Borch wrote:
> On 10 June 2015 at 11:46, Dominique Hazael-Massieux <dom@w3.org
> <mailto:dom@w3.org>> wrote:
>
> On 10/06/2015 08:32, Njaal Borch wrote:
>
> there's even the rather horrible race condition in all the two-step
> versions:
>
> if somestate execute func1;
> <--- somestate changes
> somestate.on("change", func1);
>
>
> I don't think that ("somestate changes") can happen within the
> semantics of JavaScript — i.e. no state can be changed "in the
> background" beore the current function stack is fully run through.
>
>
> Can not somestate change if that is for example the readiness of a video
> element? Presumably things can happen in the browser in parallel even
> if the JS engine does not?
Nope (or rather, that change is not reflected to the engine until the
current stack is done).
>
> You'd think so, right? I'm not sure why FF doesn't actually do this,
> but I was assuming it to be because "canplay" has gone from false to
> true before I register the event listener.
It doesn't behave this way for me - the attached test run in Firefox
displays "ready to play" as expected.
Dom