On Mon, Apr 18, 2011 at 12:55 PM, Adrian Bateman <[email protected]> wrote: > On Monday, April 18, 2011 12:04 PM, Jonas Sicking wrote: >> On Mon, Apr 18, 2011 at 9:02 AM, Adrian Bateman <[email protected]> >> wrote: >> > On Friday, April 15, 2011 2:41 PM, Jonas Sicking wrote: >> >> Yes. I.e. the semantics of readAsX is basically: >> >> >> >> readAsX(...) { >> >> if (requestInProgress) >> >> abort(); >> >> >> >> ... start new reading ... > >> >> Calling the abort() fires the "abort" and "loadend" events before the >> >> function returns. Likewise readAsX fires the "loadstart" event before >> >> it returns. So if a load has already started, then readAsX fires, >> >> before it returns, the following events in order: >> >> >> >> "abort", "loadend", "loadstart" >> >> >> >> But indeed, the spec needs improvements here. >> > >> > Does loadstart fire synchronously or asynchronously (presuming the first >> two fire >> > synchronously?)? >> >> All three fire synchronously. I.e. all three events fire before the >> readAsX function returns. > > Currently the spec says "Queue a task to dispatch a progress event called > loadstart". Is that incorrect or just different when restarting a read?
That is incorrect. The spec currently needs a lot of work in regards to the event firing, so don't assume it is correct for now. The basic idea is to follow XMLHttpRequest. / Jonas
