diff options
author | 高灰 <www@zeroplace.cn> | 2020-09-22 23:30:18 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-22 17:30:18 +0200 |
commit | 15ae361485056b236a9484a185238f992806e1ff (patch) | |
tree | 1826adb493e9276b1c49289e6a1e9ee4239f0c34 /src | |
parent | df6858df2ed3fc5c424591a5e09b900eb4ce0417 (diff) | |
download | jquery-15ae361485056b236a9484a185238f992806e1ff.tar.gz jquery-15ae361485056b236a9484a185238f992806e1ff.zip |
Manipulation: Respect script crossorigin attribute in DOM manipulation
Fixes gh-4542
Closes gh-4563
Co-authored-by: Michał Gołębiowski-Owczarek <m.goleb@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/manipulation.js | 3 | ||||
-rw-r--r-- | src/manipulation/_evalUrl.js | 1 |
2 files changed, 3 insertions, 1 deletions
diff --git a/src/manipulation.js b/src/manipulation.js index 8eca61add..7838e2293 100644 --- a/src/manipulation.js +++ b/src/manipulation.js @@ -157,7 +157,8 @@ function domManip( collection, args, callback, ignored ) { // Optional AJAX dependency, but won't run scripts if not present if ( jQuery._evalUrl && !node.noModule ) { jQuery._evalUrl( node.src, { - nonce: node.nonce || node.getAttribute( "nonce" ) + nonce: node.nonce || node.getAttribute( "nonce" ), + crossOrigin: node.crossOrigin }, doc ); } } else { diff --git a/src/manipulation/_evalUrl.js b/src/manipulation/_evalUrl.js index 0f7559ff0..8a8d63d9d 100644 --- a/src/manipulation/_evalUrl.js +++ b/src/manipulation/_evalUrl.js @@ -10,6 +10,7 @@ jQuery._evalUrl = function( url, options, doc ) { cache: true, async: false, global: false, + scriptAttrs: options.crossOrigin ? { "crossOrigin": options.crossOrigin } : undefined, // Only evaluate the response if it is successful (gh-4126) // dataFilter is not invoked for failure responses, so using it instead |