Skip to content
Permalink
Browse files

Remove s.dataTypes = [ "a" , "b" ] in favor of s.dataType = "a b".

Signed-off-by: jaubourg <aubourg.julian@gmail.com>
  • Loading branch information
jaubourg
jaubourg committed Feb 13, 2010
1 parent 4bf5370 commit 608230495d9f2235dc7461ff0d5b3f61d4f886fb
Showing with 5 additions and 18 deletions.
  1. +0 −4 src/transports/jsonp.js
  2. +4 −13 src/xhr.js
  3. +1 −1 test/unit/ajax.js
@@ -33,10 +33,6 @@ jQuery.xhr.prefilter( function(s) {
s.data = data;

s.dataTypes[0] = "json";

if ( s.dataTypes.length == 1 ) {
s.dataType = "json";
}
}

});
@@ -51,14 +51,10 @@ jQuery.xhr = function( _native ) {
// Datatype
if ( ! s.dataType ) {
s.dataType = "*";
} else {
s.dataType = jQuery.trim(s.dataType).toLowerCase();
}
if ( ! jQuery.isArray( s.dataTypes ) || ! s.dataTypes.length ) {
s.dataTypes = [s.dataType];
}
for ( i = 0, length = s.dataTypes.length ; i < length ; i++ ) {
s.dataTypes[i] = s.dataTypes[i].toLowerCase();
}
s.dataType = s.dataTypes[s.dataTypes.length-1];
s.dataTypes = s.dataType.split(/\s+/);

// Convert data if not already a string
if ( s.data && s.processData && typeof s.data != "string" ) {
@@ -79,9 +75,7 @@ jQuery.xhr = function( _native ) {
// If internal was found
if ( internal ) {

// Set dataType to proper value (in case transport filters changed it)
// And get transportDataType
s.dataType = s.dataTypes[s.dataTypes.length-1];
// Get transportDataType
transportDataType = s.dataTypes[0];

// More options handling for GET requests
@@ -851,9 +845,6 @@ jQuery.extend(jQuery.xhr, {
for ( type in autoDataType ) {
if ( ( regexp = autoDataType[ type ] ) && regexp.test( ct ) ) {
transportDataType = dataTypes[0] = type;
if ( dataTypes.length === 1 ) {
s.dataType = transportDataType;
}
break;
}
}
@@ -622,7 +622,7 @@ jQuery.each([false,true], function(_,overIFrame) {
stop();
jQuery.ajax({
url: url("data/with_fries_over_jsonp.php"),
dataTypes: ["jsonp","xml"],
dataType: "jsonp xml",
jsonpOverIFrame: overIFrame,
success: function(resp) {
equals( jQuery("properties", resp).length, 1, 'properties in responseXML' );

0 comments on commit 6082304

Please sign in to comment.
You can’t perform that action at this time.