Just comitted version 2 of the ajax refactoring for those interested. The
tree is in sync with latest jQuery tree.

No more global transport selection function: transports are now bound to
dataTypes through jQuery.ajax.bindTransport( dataTypeSelector,
factoryFunction ). The dataTypeSelector is a string containing dataType
names separated by spaces. If you put a + sign in front of the dataType
name, then the transport will be the first one to be tested for that
specific dataType.

For instance: jQuery.ajax.bindTransport( "+json text",
myTransportFactoryFunction ) ensures myTransportFactoryFunction is the first
one called for a request with json dataType and the last one called for a
request with test dataType.

The factory function is in charge of determining if its transport is
suitable for the given request (it gets the request options object as its
only parameter). It can return the transport object (with a mandatory send
method and an optional abort method) or nothing (or false). If it does the
latter, two cases :
1) the dataType in the options object hasn't been changed, in which case the
selector looks for the next transport in line
2) the dataType has been changed and the selector intelligently redirects to
the transports for this new dataType.

Transports are tested for the dataType and, if non was found, for the
catchall "*" transports. An exception is raised if no transport is found.

Edge cases, such as cumbersome request type detections, can be handled using
jQuery.ajax.prefilter( prefilteringFunction ): you can see an example of
that in transports/jsonp.js.

--

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=en.


Reply via email to