X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;f=src%2Fajax.js;h=43bab7c3d702db7f616b9e887b57ab8c98ead498;hb=92c3d87a9cdd611af06e46a5e66a4876c2be5ed0;hp=3eb36c3a8e886e1ba07aac668774d3f184432aea;hpb=21143c3b213843bc202c16b5532b6e9de951eb2c;p=jquery.git diff --git a/src/ajax.js b/src/ajax.js index 3eb36c3..43bab7c 100644 --- a/src/ajax.js +++ b/src/ajax.js @@ -182,9 +182,6 @@ jQuery.extend({ headers: {}, crossDomain: null, */ - xhr: function() { - return new window.XMLHttpRequest(); - }, accepts: { xml: "application/xml, text/xml", @@ -584,12 +581,6 @@ jQuery.extend({ // Remove hash character (#7531: and string promotion) s.url = ( "" + s.url ).replace( rhash , "" ); - // Uppercase the type - s.type = s.type.toUpperCase(); - - // Determine if request has content - s.hasContent = ! rnoContent.test( s.type ); - // Extract dataTypes list s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().split( /\s+/ ); @@ -605,13 +596,19 @@ jQuery.extend({ } // Convert data if not already a string - if ( s.data && s.processData && typeof s.data != "string" ) { + if ( s.data && s.processData && typeof s.data !== "string" ) { s.data = jQuery.param( s.data , s.traditional ); } // Apply prefilters jQuery.ajaxPrefilter( s , options ); + // Uppercase the type + s.type = s.type.toUpperCase(); + + // Determine if request has content + s.hasContent = ! rnoContent.test( s.type ); + // Watch for a new set of requests if ( s.global && jQuery.active++ === 0 ) { jQuery.event.trigger( "ajaxStart" ); @@ -977,33 +974,4 @@ function determineDataType( s , ct , text , xml ) { return response; } -/* - * Create the request object; Microsoft failed to properly - * implement the XMLHttpRequest in IE7 (can't request local files), - * so we use the ActiveXObject when it is available - * Additionally XMLHttpRequest can be disabled in IE7/IE8 so - * we need a fallback. - */ -if ( window.ActiveXObject ) { - jQuery.ajaxSettings.xhr = function() { - if ( window.location.protocol !== "file:" ) { - try { - return new window.XMLHttpRequest(); - } catch( xhrError ) {} - } - - try { - return new window.ActiveXObject("Microsoft.XMLHTTP"); - } catch( activeError ) {} - }; -} - -var testXHR = jQuery.ajaxSettings.xhr(); - -// Does this browser support XHR requests? -jQuery.support.ajax = !!testXHR; - -// Does this browser support crossDomain XHR requests -jQuery.support.cors = testXHR && "withCredentials" in testXHR; - })( jQuery );