git.asbjorn.biz
/
jquery.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Renames determineDataType as determineResponse. Makes it more generic as a first...
[jquery.git]
/
src
/
ajax.js
diff --git
a/src/ajax.js
b/src/ajax.js
index
dd3c50d
..
955856c
100644
(file)
--- a/
src/ajax.js
+++ b/
src/ajax.js
@@
-235,7
+235,7
@@
jQuery.extend({
// Utility function that handles dataType when response is received
// (for those transports that can give text or xml responses)
// Utility function that handles dataType when response is received
// (for those transports that can give text or xml responses)
- determineDataType: function( ct , text , xml ) {
+ determineResponse: function( responses , ct ) {
var s = this,
contents = s.contents,
var s = this,
contents = s.contents,
@@
-246,7
+246,7
@@
jQuery.extend({
response;
// Auto (xml, json, script or text determined given headers)
response;
// Auto (xml, json, script or text determined given headers)
- if ( transportDataType === "*" ) {
+ if ( ct && transportDataType === "*" ) {
for ( type in contents ) {
if ( ( regexp = contents[ type ] ) && regexp.test( ct ) ) {
for ( type in contents ) {
if ( ( regexp = contents[ type ] ) && regexp.test( ct ) ) {
@@
-256,23
+256,22
@@
jQuery.extend({
}
}
}
}
- // xml and parsed as such
- if ( transportDataType === "xml" &&
- xml &&
- xml.documentElement /* #4958 */ ) {
-
- response = xml;
-
- // Text response was provided
- } else {
+ // Get response
+ for( type in responses ) {
+ if ( type === transportDataType ) {
+ break;
+ }
+ }
- response = text;
+ // Get final response
+ response = responses[ type ];
- // If it's not really text, defer to converters
- if ( transportDataType !== "text" ) {
- dataTypes.unshift( "text" );
+ // If it's not the right dataType, handle the dataTypeList
+ if ( transportDataType !== type ) {
+ if ( transportDataType === "*" ) {
+ dataTypes.shift();
}
}
-
+ dataTypes.unshift( type );
}
return response;
}
return response;