X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;f=src%2Fajax%2Fxhr.js;h=7a4da2ddb5fc4a685d94372d2c97194f57d9868f;hb=3dbd600e1961d9ab5296afbf2b3eb0852ad176e0;hp=4acb700545f5a67d2347302aca51a6f92e6b6dd4;hpb=1cecfa1ece0d48b253fb0775bba645c464e363a4;p=jquery.git diff --git a/src/ajax/xhr.js b/src/ajax/xhr.js index 4acb700..7a4da2d 100644 --- a/src/ajax/xhr.js +++ b/src/ajax/xhr.js @@ -12,8 +12,8 @@ var // Next active xhr id // XHR used to determine supports properties testXHR; -// Create the request object; Microsoft failed to properly -// (This is still attached to ajaxSettings for backward compatibility reasons) +// Create the request object +// (This is still attached to ajaxSettings for backward compatibility) jQuery.ajaxSettings.xhr = window.ActiveXObject ? /* Microsoft failed to properly * implement the XMLHttpRequest in IE7 (can't request local files), @@ -128,7 +128,6 @@ if ( jQuery.support.ajax ) { callback = 0; // Do not keep as active anymore - // and store back into pool if (handle) { xhr.onreadystatechange = jQuery.noop; delete xhrs[ handle ]; @@ -146,8 +145,15 @@ if ( jQuery.support.ajax ) { // Get info var status = xhr.status, statusText, - response, - responseHeaders = xhr.getAllResponseHeaders(); + responseHeaders = xhr.getAllResponseHeaders(), + responses = {}, + xml = xhr.responseXML; + + // Construct response list + if ( xml && xml.documentElement /* #4958 */ ) { + responses.xml = xml; + } + responses.text = xhr.responseText; try { // Firefox throws an exception when accessing statusText for faulty cross-domain requests @@ -184,15 +190,8 @@ if ( jQuery.support.ajax ) { status ); - // Guess response & update dataType accordingly - response = - s.determineDataType( - xhr.getResponseHeader("content-type"), - xhr.responseText, - xhr.responseXML ); - // Call complete - complete(status,statusText,response,responseHeaders); + complete(status,statusText,responses,responseHeaders); } } };