Skip to content
Permalink
Browse files

Revised conversion logic to handle converter equal to true properly.

  • Loading branch information...
jaubourg committed Dec 29, 2010
1 parent 54d965f commit 7490eb4f8e1930ca370eec21b4d5469f87b65db6
Showing with 19 additions and 14 deletions.
  1. +19 −14 src/ajax.js
@@ -393,9 +393,9 @@ jQuery.extend({
current,
prev,
checker,
conv,
conv1,
conv2,
oneConv,
convertion,
dataTypes = s.dataTypes,
converters = s.converters,
@@ -419,23 +419,28 @@ jQuery.extend({

if ( prev !== "*" && current !== "*" && prev !== current ) {

oneConv = conv1 =
converters[ ( conversion = prev + " " + current ) ] ||
conv = converters[ ( conversion = prev + " " + current ) ] ||
converters[ "* " + current ];

if ( oneConv !== true ) {

if ( ! oneConv && prev !== "text" && current !== "text" ) {
conv1 = converters[ prev + " text" ] || converters[ "* text" ];
conv2 = converters[ "text " + current ];
}

if ( oneConv || conv1 && conv2 ) {
response = oneConv ? conv1( response ) : conv2( conv1( response ) );
} else {
throw "no " + conversion;
conv1 = conv2 = 0;

if ( ! conv && prev !== "text" && current !== "text" ) {
conv1 = converters[ prev + " text" ] || converters[ "* text" ];
conv2 = converters[ "text " + current ];
if ( conv1 === true ) {
conv = conv2;
} else if ( conv2 === true ) {
conv = conv1;
}
}

if ( ! ( conv || conv1 && conv2 ) ) {
throw conversion;
}

if ( conv !== true ) {
response = conv ? conv( response ) : conv2( conv1( response ) );
}
}
} else if ( s.dataFilter ) {

0 comments on commit 7490eb4

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.