aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorjaubourg <j@ubourg.net>2010-12-29 18:44:45 +0100
committerjaubourg <j@ubourg.net>2010-12-31 04:15:12 +0100
commit3c6f1380fa67542ff8c67d6363a865ae3ec23516 (patch)
tree3406e6f56fb3b9ba6a2330cfe24e50b2e748da53 /src
parent6dbffb8596a9c96c68386ecc2d95da25b9dee369 (diff)
downloadjquery-3c6f1380fa67542ff8c67d6363a865ae3ec23516.tar.gz
jquery-3c6f1380fa67542ff8c67d6363a865ae3ec23516.zip
Revised conversion logic to handle converter equal to true properly.
Diffstat (limited to 'src')
-rw-r--r--src/ajax.js33
1 files changed, 19 insertions, 14 deletions
diff --git a/src/ajax.js b/src/ajax.js
index 0fca962aa..5e58a0fa0 100644
--- a/src/ajax.js
+++ b/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 ) {