Moved unload abort code so that the event is only bound if the xhr transport is used...
[jquery.git] / src / ajax.js
index e910aa5..dbea8d5 100644 (file)
@@ -520,12 +520,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 +536,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 ) {