Skip to content

Commit c68fbc2

Browse files
committed
There's enough logic going on in jQuery.ajaxSettings.xhr to warrant splitting the function based upon the functionality.
1 parent 84dd82e commit c68fbc2

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/ajax.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -178,16 +178,15 @@ jQuery.extend({
178178
// implement the XMLHttpRequest in IE7 (can't request local files),
179179
// so we use the ActiveXObject when it is available
180180
// This function can be overriden by calling jQuery.ajaxSetup
181-
xhr: function() {
182-
if ( window.XMLHttpRequest && (window.location.protocol !== "file:" || !window.ActiveXObject) ) {
181+
xhr: window.XMLHttpRequest && (window.location.protocol !== "file:" || !window.ActiveXObject) ?
182+
function() {
183183
return new window.XMLHttpRequest();
184-
185-
} else {
184+
} :
185+
function() {
186186
try {
187187
return new window.ActiveXObject("Microsoft.XMLHTTP");
188188
} catch(e) {}
189-
}
190-
},
189+
},
191190
accepts: {
192191
xml: "application/xml, text/xml",
193192
html: "text/html",

0 commit comments

Comments
 (0)