X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=src%2Fajax.js;h=d570fcccb8173d02e34ddf59e118fff4ebdc3ec0;hb=fcf623786aeae20485e5253bd2b66c8758053646;hp=e910aa56f73d78c92e347450de6e3a867af68d6b;hpb=c55a76a23fdf8e9b22d9792a0f3a39051cc33993;p=jquery.git diff --git a/src/ajax.js b/src/ajax.js index e910aa5..d570fcc 100644 --- a/src/ajax.js +++ b/src/ajax.js @@ -11,6 +11,7 @@ var r20 = /%20/g, rselectTextarea = /^(?:select|textarea)/i, rts = /([?&])_=[^&]*/, rurl = /^(\w+:)?\/\/([^\/?#:]+)(?::(\d+))?/, + rCRLF = /\r?\n/g, // Slice function sliceFunc = Array.prototype.slice, @@ -107,9 +108,9 @@ jQuery.fn.extend({ null : jQuery.isArray(val) ? jQuery.map( val, function(val, i){ - return {name: elem.name, value: val.replace(/\r?\n/g, "\r\n")}; + return { name: elem.name, value: val.replace(rCRLF, "\r\n") }; }) : - {name: elem.name, value: val.replace(/\r?\n/g, "\r\n")}; + { name: elem.name, value: val.replace(rCRLF, "\r\n") }; }).get(); } }); @@ -520,12 +521,15 @@ jQuery.extend({ // Determine if a cross-domain request is in order var parts = rurl.exec( s.url.toLowerCase() ), loc = location; - s.crossDomain = !!( - parts && - ( parts[ 1 ] && parts[ 1 ] != loc.protocol || - parts[ 2 ] != loc.hostname || - ( parts[ 3 ] || 80 ) != ( loc.port || 80 ) ) - ); + + if ( ! s.crossDomain ) { + s.crossDomain = !!( + parts && + ( parts[ 1 ] && parts[ 1 ] != loc.protocol || + parts[ 2 ] != loc.hostname || + ( parts[ 3 ] || 80 ) != ( loc.port || 80 ) ) + ); + } // Convert data if not already a string if ( s.data && s.processData && typeof s.data != "string" ) { @@ -533,7 +537,7 @@ jQuery.extend({ } // Get transport - transport = jQuery.ajax.prefilter( s ).transport( s ); + transport = jQuery.ajax.prefilter( s , options ).transport( s ); // Watch for a new set of requests if ( s.global && jQuery.active++ === 0 ) {