diff options
author | Richard Gibson <richard.gibson@gmail.com> | 2012-09-18 17:39:44 -0400 |
---|---|---|
committer | Dave Methvin <dave.methvin@gmail.com> | 2012-09-18 18:04:31 -0400 |
commit | 15b5dbfe2386d67b8c1df3305812b35abc04458c (patch) | |
tree | e762b8301177061e96654586353cdab821b4280e /src/ajax.js | |
parent | e8e3e90a8620a945d2d4f6012a604d96db2bd317 (diff) | |
download | jquery-15b5dbfe2386d67b8c1df3305812b35abc04458c.tar.gz jquery-15b5dbfe2386d67b8c1df3305812b35abc04458c.zip |
Fix #12229, size/consistency improvements. Close gh-887.
Diffstat (limited to 'src/ajax.js')
-rw-r--r-- | src/ajax.js | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/src/ajax.js b/src/ajax.js index cfbfcd527..5e1fb2d94 100644 --- a/src/ajax.js +++ b/src/ajax.js @@ -1,7 +1,7 @@ -var // Document location - ajaxLocation, - // Document location segments +var + // Document location ajaxLocParts, + ajaxLocation, rhash = /#.*$/, rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL @@ -518,7 +518,7 @@ jQuery.extend({ // Set data for the fake xhr object jqXHR.status = status; - jqXHR.statusText = "" + ( nativeStatusText || statusText ); + jqXHR.statusText = ( nativeStatusText || statusText ) + ""; // Success/Error if ( isSuccess ) { @@ -578,14 +578,11 @@ jQuery.extend({ // Extract dataTypes list s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().split( core_rspace ); - // Determine if a cross-domain request is in order + // A cross-domain request is in order when we have a protocol:host:port mismatch if ( s.crossDomain == null ) { - parts = rurl.exec( s.url.toLowerCase() ); - s.crossDomain = !!( parts && - ( parts[ 1 ] != ajaxLocParts[ 1 ] || parts[ 2 ] != ajaxLocParts[ 2 ] || - ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? 80 : 443 ) ) != - ( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? 80 : 443 ) ) ) - ); + parts = rurl.exec( s.url.toLowerCase() ) || false; + s.crossDomain = parts && ( parts.join(":") + ( parts[ 3 ] ? "" : parts[ 1 ] === "http:" ? 80 : 443 ) ) !== + ( ajaxLocParts.join(":") + ( ajaxLocParts[ 3 ] ? "" : ajaxLocParts[ 1 ] === "http:" ? 80 : 443 ) ); } // Convert data if not already a string |