Oh yes, also, ajax could handle image preloading too imo. 2009/11/12 Julian Aubourg <aubourg.jul...@gmail.com>
> Regarding the abort possibility for jsonp (#5500 => #3442), this brings us > back to the idea of returning an abstraction on top of the actual xhr/script > hack/whatever. > > I was curious as to why the whole ajax typology wasn't implemented with a > factory pattern: you would call something like XHRFactory.get(options) which > would return an abstraction with the same interface as an xhr. This would > hide routing into the factory code and all the hacks into the different > abstractions (including handling the replacement of ? with the callback > name, creating a script tag -- or an iframe in my own implementation of > jsonp--, etc, etc) and keep the ajax function clean (calling everything as > if it were pure xhr no matter the situation). Each implementation that do > not implement some features (like header manipulation for script hacks) > would simply do nothing when those methods are called. Plus, the interface > could be enhanced to handle the .bind(type,func) we talked about in the > other thread (and deferred error/success/etc callback bindings). > Furthermore, each implementation would be replaceable by user code (we could > keep the xhr setting active, it would only act on pure xhr calls). > > I'd be willing to give it a try (knowing you would more than surely have to > clean it up to jQuery's standards after), just let me know if I'm crazy or > something. > > 2009/11/12 John Resig <jere...@gmail.com> > > I created some tickets for the missing features: >> http://dev.jquery.com/ticket/5500 >> http://dev.jquery.com/ticket/5501 >> http://dev.jquery.com/ticket/5502 >> >> --John >> >> >> >> On Thu, Nov 12, 2009 at 9:58 AM, John Resig <jere...@gmail.com> wrote: >> > Hi Dave - >> > >> > This so much for pulling this together, it's very useful. >> > >> > I see some definite gaps that can be closed, when looking at this (for >> > script/json/jsonp): >> > - beforeSend/ajaxSend >> > - dataFilter >> > - processData >> > - timeout >> > >> > Now, error and ajaxError could be handled - but to a limited degree. >> > If we implement timeout support then we could have the error/ajaxError >> > occur if the timeout happens - but we can't do it for malformed >> > JSON/script/jsonp, since the browser doesn't provide us with that >> > information. At best the script would come in, throw an exception, and >> > then the timeout would happen a couple seconds later. If we were to >> > make this change the timeout would have to happen automatically as >> > well (which is different from the other request types). >> > >> > Cannot work with script/json/jsonp and should be documented as such: >> > - async >> > - contentType >> > - ifModified >> > - username / password >> > - type (POST) >> > - xhr >> > - error/ajaxError for malformed data >> > >> > --John >> > >> > >> > >> > On Wed, Nov 11, 2009 at 7:55 PM, Dave Methvin <dave.meth...@gmail.com> >> wrote: >> >> Re: http://groups.google.com/group/jquery-dev/msg/70b913e489c9fc8f >> >> >> >> Here is what I came up with. I built this mostly by looking at the >> >> source to ajax.js so let me know if there is anything that looks >> >> wrong: >> >> >> >> >> http://spreadsheets.google.com/ccc?key=0Aj5JJFjq9rZDdC1OQjJOcmtjTmtBUVdXV2NPczE2R2c&hl=en >> >> >> >> Does anyone see any errors, or have suggestions on different >> >> presentation? >> >> >> >> -- >> >> >> >> 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<jquery-dev%2bunsubscr...@googlegroups.com> >> . >> >> For more options, visit this group at >> http://groups.google.com/group/jquery-dev?hl=. >> >> >> >> >> >> >> > >> >> -- >> >> 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<jquery-dev%2bunsubscr...@googlegroups.com> >> . >> For more options, visit this group at >> http://groups.google.com/group/jquery-dev?hl=. >> >> >> > -- 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=.