From 1f4375a34227f42570d2b72e190e51bcfb1e8597 Mon Sep 17 00:00:00 2001 From: Dave Methvin Date: Tue, 12 Sep 2017 12:40:00 -0400 Subject: [PATCH] Ajax: Allow custom attributes when script transport is used Fixes gh-3028 Ref gh-2612 Useful, for example, to add `nonce`, `integrity`, or `crossorigin`. --- src/ajax/script.js | 6 +++--- test/unit/ajax.js | 23 +++++++++++++++++++++++ 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/src/ajax/script.js b/src/ajax/script.js index 6e0d21e99..292627f7e 100644 --- a/src/ajax/script.js +++ b/src/ajax/script.js @@ -43,15 +43,15 @@ jQuery.ajaxPrefilter( "script", function( s ) { // Bind script tag hack transport jQuery.ajaxTransport( "script", function( s ) { - // This transport only deals with cross domain requests - if ( s.crossDomain ) { + // This transport only deals with cross domain or forced-by-attrs requests + if ( s.crossDomain || s.scriptAttrs ) { var script, callback; return { send: function( _, complete ) { script = jQuery( "