Further fix for #3333, refactored marginRight css hook to use jQuery.swap and compute...
[jquery.git] / src / ajax / xhr.js
index e21847a..5dbc33d 100644 (file)
@@ -26,7 +26,7 @@ function createStandardXHR() {
 
 function createActiveXHR() {
        try {
-               return new window.ActiveXObject("Microsoft.XMLHTTP");
+               return new window.ActiveXObject( "Microsoft.XMLHTTP" );
        } catch( e ) {}
 }
 
@@ -92,11 +92,12 @@ if ( jQuery.support.ajax ) {
                                                xhr.overrideMimeType( s.mimeType );
                                        }
 
-                                       // Requested-With header
-                                       // Not set for crossDomain requests with no content
-                                       // (see why at http://trac.dojotoolkit.org/ticket/9486)
-                                       // Won't change header if already provided
-                                       if ( !( s.crossDomain && !s.hasContent ) && !headers["X-Requested-With"] ) {
+                                       // X-Requested-With header
+                                       // For cross-domain requests, seeing as conditions for a preflight are
+                                       // akin to a jigsaw puzzle, we simply never set it to be sure.
+                                       // (it can always be set on a per-request basis or even using ajaxSetup)
+                                       // For same-domain requests, won't change header if already provided.
+                                       if ( !s.crossDomain && !headers["X-Requested-With"] ) {
                                                headers[ "X-Requested-With" ] = "XMLHttpRequest";
                                        }
 
@@ -166,14 +167,16 @@ if ( jQuery.support.ajax ) {
                                                                        }
 
                                                                        // Filter status for non standard behaviors
-                                                                       status =
-                                                                               // If the request is local and we have data: assume a success
-                                                                               // (success with no data won't get notified, that's the best we
-                                                                               // can do given current implementations)
-                                                                               !status && s.isLocal ?
-                                                                               ( responses.text ? 200 : 404 ) :
-                                                                               // IE - #1450: sometimes returns 1223 when it should be 204
-                                                                               ( status === 1223 ? 204 : status );
+
+                                                                       // If the request is local and we have data: assume a success
+                                                                       // (success with no data won't get notified, that's the best we
+                                                                       // can do given current implementations)
+                                                                       if ( !status && s.isLocal && !s.crossDomain ) {
+                                                                               status = responses.text ? 200 : 404;
+                                                                       // IE - #1450: sometimes returns 1223 when it should be 204
+                                                                       } else if ( status === 1223 ) {
+                                                                               status = 204;
+                                                                       }
                                                                }
                                                        }
                                                } catch( firefoxAccessException ) {