There's enough logic going on in jQuery.ajaxSettings.xhr to warrant splitting the function based upon the functionality.

This commit is contained in:
jeresig 2010-01-07 10:00:55 -05:00
parent 84dd82eb1a
commit c68fbc2071

View file

@ -178,15 +178,14 @@ jQuery.extend({
// implement the XMLHttpRequest in IE7 (can't request local files), // implement the XMLHttpRequest in IE7 (can't request local files),
// so we use the ActiveXObject when it is available // so we use the ActiveXObject when it is available
// This function can be overriden by calling jQuery.ajaxSetup // This function can be overriden by calling jQuery.ajaxSetup
xhr: function() { xhr: window.XMLHttpRequest && (window.location.protocol !== "file:" || !window.ActiveXObject) ?
if ( window.XMLHttpRequest && (window.location.protocol !== "file:" || !window.ActiveXObject) ) { function() {
return new window.XMLHttpRequest(); return new window.XMLHttpRequest();
} :
} else { function() {
try { try {
return new window.ActiveXObject("Microsoft.XMLHTTP"); return new window.ActiveXObject("Microsoft.XMLHTTP");
} catch(e) {} } catch(e) {}
}
}, },
accepts: { accepts: {
xml: "application/xml, text/xml", xml: "application/xml, text/xml",