Revised conversion logic to handle converter equal to true properly.
This commit is contained in:
parent
54d965ffa5
commit
7490eb4f8e
33
src/ajax.js
33
src/ajax.js
|
@ -393,9 +393,9 @@ jQuery.extend({
|
||||||
current,
|
current,
|
||||||
prev,
|
prev,
|
||||||
checker,
|
checker,
|
||||||
|
conv,
|
||||||
conv1,
|
conv1,
|
||||||
conv2,
|
conv2,
|
||||||
oneConv,
|
|
||||||
convertion,
|
convertion,
|
||||||
dataTypes = s.dataTypes,
|
dataTypes = s.dataTypes,
|
||||||
converters = s.converters,
|
converters = s.converters,
|
||||||
|
@ -419,23 +419,28 @@ jQuery.extend({
|
||||||
|
|
||||||
if ( prev !== "*" && current !== "*" && prev !== current ) {
|
if ( prev !== "*" && current !== "*" && prev !== current ) {
|
||||||
|
|
||||||
oneConv = conv1 =
|
conv = converters[ ( conversion = prev + " " + current ) ] ||
|
||||||
converters[ ( conversion = prev + " " + current ) ] ||
|
|
||||||
converters[ "* " + current ];
|
converters[ "* " + current ];
|
||||||
|
|
||||||
if ( oneConv !== true ) {
|
conv1 = conv2 = 0;
|
||||||
|
|
||||||
if ( ! oneConv && prev !== "text" && current !== "text" ) {
|
if ( ! conv && prev !== "text" && current !== "text" ) {
|
||||||
conv1 = converters[ prev + " text" ] || converters[ "* text" ];
|
conv1 = converters[ prev + " text" ] || converters[ "* text" ];
|
||||||
conv2 = converters[ "text " + current ];
|
conv2 = converters[ "text " + current ];
|
||||||
}
|
if ( conv1 === true ) {
|
||||||
|
conv = conv2;
|
||||||
if ( oneConv || conv1 && conv2 ) {
|
} else if ( conv2 === true ) {
|
||||||
response = oneConv ? conv1( response ) : conv2( conv1( response ) );
|
conv = conv1;
|
||||||
} else {
|
|
||||||
throw "no " + conversion;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( ! ( conv || conv1 && conv2 ) ) {
|
||||||
|
throw conversion;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( conv !== true ) {
|
||||||
|
response = conv ? conv( response ) : conv2( conv1( response ) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if ( s.dataFilter ) {
|
} else if ( s.dataFilter ) {
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue