diff options
author | Dave Methvin <dave.methvin@gmail.com> | 2017-09-12 12:40:00 -0400 |
---|---|---|
committer | Dave Methvin <dave.methvin@gmail.com> | 2018-05-14 14:09:43 -0400 |
commit | 1f4375a34227f42570d2b72e190e51bcfb1e8597 (patch) | |
tree | 70bda12a0a500114c3ef540d85b7f08bbfdcc758 /src/ajax/script.js | |
parent | 29e76e254059f8c2b695f4e41054260b52a6910d (diff) | |
download | jquery-1f4375a34227f42570d2b72e190e51bcfb1e8597.tar.gz jquery-1f4375a34227f42570d2b72e190e51bcfb1e8597.zip |
Ajax: Allow custom attributes when script transport is used
Fixes gh-3028
Ref gh-2612
Useful, for example, to add `nonce`, `integrity`, or `crossorigin`.
Diffstat (limited to 'src/ajax/script.js')
-rw-r--r-- | src/ajax/script.js | 6 |
1 files changed, 3 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( "<script>" ).prop( { charset: s.scriptCharset, src: s.url - } ).on( + } ).attr( s.scriptAttrs || {} ).on( "load error", callback = function( evt ) { script.remove(); |