> > > $.get(url, callback).error( onError ) > > > That creates a potential race condition, since the async request is > > made and may complete before the onError handler is attached. > > Is that really true? I thought javascript was strictly single > threaded...
> > That creates a potential race condition, since the async request is > > made and may complete before the onError handler is attached. > > Is that really true? I thought javascript was strictly single > threaded... A request for a remote resource is made asynchronously on a different thread though. It's also possible that a browser might synchronously check to see if the file is in the local cache, and if so mark the request as complete and queue up any DOM events that need to fire (e.g. image onload) before it continued to the next method in the chain. But I was thinking this was a native DOM event, which it isn't. In this case the proposed xhr.error method could check to see if the request already completed and run the handler immediately, like someone said upthread. So it wouldn't be a problem for this case. -- You received this message because you are subscribed to the Google Groups "jQuery Development" group. To post to this group, send email to jquery-...@googlegroups.com. To unsubscribe from this group, send email to jquery-dev+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=.