diff options
Diffstat (limited to 'src/core/DOMEval.js')
-rw-r--r-- | src/core/DOMEval.js | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/src/core/DOMEval.js b/src/core/DOMEval.js index b0238fd69..059464188 100644 --- a/src/core/DOMEval.js +++ b/src/core/DOMEval.js @@ -10,26 +10,14 @@ var preservedScriptAttributes = { function DOMEval( code, node, doc ) { doc = doc || document; - var i, val, + var i, script = doc.createElement( "script" ); script.text = code; if ( node ) { for ( i in preservedScriptAttributes ) { - - // Support: Firefox <=64 - 66+, Edge <=18+ - // Some browsers don't support the "nonce" property on scripts. - // On the other hand, just using `getAttribute` is not enough as - // the `nonce` attribute is reset to an empty string whenever it - // becomes browsing-context connected. - // See https://github.com/whatwg/html/issues/2369 - // See https://html.spec.whatwg.org/#nonce-attributes - // The `node.getAttribute` check was added for the sake of - // `jQuery.globalEval` so that it can fake a nonce-containing node - // via an object. - val = node[ i ] || node.getAttribute && node.getAttribute( i ); - if ( val ) { - script.setAttribute( i, val ); + if ( node[ i ] ) { + script[ i ] = node[ i ]; } } } |