Ajax: Simplify jQuery.ajaxSettings.xhr

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
This commit is contained in:
Michał Gołębiowski-Owczarek 2019-08-26 19:01:26 +02:00 committed by GitHub
parent d7e64190ef
commit abdc89ac2e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -6,9 +6,7 @@ define( [
"use strict"; "use strict";
jQuery.ajaxSettings.xhr = function() { jQuery.ajaxSettings.xhr = function() {
try { return new window.XMLHttpRequest();
return new window.XMLHttpRequest();
} catch ( e ) {}
}; };
var xhrSuccessStatus = { var xhrSuccessStatus = {