Copybara bot | be50d49 | 2023-11-30 00:16:42 +0100 | [diff] [blame] | 1 | define( [ |
| 2 | "../ajax" |
| 3 | ], function( jQuery ) { |
| 4 | |
| 5 | "use strict"; |
| 6 | |
Renovate bot | f591dcf | 2023-12-30 14:13:54 +0000 | [diff] [blame] | 7 | jQuery._evalUrl = function( url, options, doc ) { |
Copybara bot | be50d49 | 2023-11-30 00:16:42 +0100 | [diff] [blame] | 8 | return jQuery.ajax( { |
| 9 | url: url, |
| 10 | |
| 11 | // Make this explicit, since user can override this through ajaxSetup (#11264) |
| 12 | type: "GET", |
| 13 | dataType: "script", |
| 14 | cache: true, |
| 15 | async: false, |
| 16 | global: false, |
| 17 | |
| 18 | // Only evaluate the response if it is successful (gh-4126) |
| 19 | // dataFilter is not invoked for failure responses, so using it instead |
| 20 | // of the default converter is kludgy but it works. |
| 21 | converters: { |
| 22 | "text script": function() {} |
| 23 | }, |
| 24 | dataFilter: function( response ) { |
Renovate bot | f591dcf | 2023-12-30 14:13:54 +0000 | [diff] [blame] | 25 | jQuery.globalEval( response, options, doc ); |
Copybara bot | be50d49 | 2023-11-30 00:16:42 +0100 | [diff] [blame] | 26 | } |
| 27 | } ); |
| 28 | }; |
| 29 | |
| 30 | return jQuery._evalUrl; |
| 31 | |
| 32 | } ); |