Skip to content

Commit

Permalink
Ajax: Simplify jQuery.ajaxSettings.xhr
Browse files Browse the repository at this point in the history
Previously, jQuery.ajaxSettings.xhr, contents were wrapped in a try-catch
as we defined jQuery.support.ajax & jQuery.support.cors executed during the
jQuery load and we didn't want to crash if IE had native XHR disabled (which
is possible). While jQuery hasn't supported the ActiveX-based XHR since 2.0,
jQuery with XHR disabled could still be used for its other features in such
a crippled browser.

Since gh-4347, jQuery.support.ajax & jQuery.support.cors no longer exist, so
we don't need the try-catch anymore.

Fixes gh-1967
Closes gh-4467
Ref gh-4347
  • Loading branch information
mgol committed Aug 26, 2019
1 parent d7e6419 commit abdc89a
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/ajax/xhr.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ define( [
"use strict";

jQuery.ajaxSettings.xhr = function() {
try {
return new window.XMLHttpRequest();
} catch ( e ) {}
return new window.XMLHttpRequest();
};

var xhrSuccessStatus = {
Expand Down

0 comments on commit abdc89a

Please sign in to comment.