diff options
author | basil.belokon <basil.belokon@gmail.com> | 2017-12-03 15:58:09 +0600 |
---|---|---|
committer | Timmy Willison <4timmywil@gmail.com> | 2018-01-16 11:39:16 -0500 |
commit | 5d3a968e031ab8dff5c07e1d6bb4f196fb82bfa0 (patch) | |
tree | 8cb0c8082469f637c38ca90b5dc4c60b9c54f57f /src/core/DOMEval.js | |
parent | 428ee4a62488457a1bc568e7475cbf65b1feaf93 (diff) | |
download | jquery-5d3a968e031ab8dff5c07e1d6bb4f196fb82bfa0.tar.gz jquery-5d3a968e031ab8dff5c07e1d6bb4f196fb82bfa0.zip |
Manipulation: Add support for scripts with module type
Fixes gh-3871
Close gh-3869
Diffstat (limited to 'src/core/DOMEval.js')
-rw-r--r-- | src/core/DOMEval.js | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/core/DOMEval.js b/src/core/DOMEval.js index c49c12e5e..199ec9518 100644 --- a/src/core/DOMEval.js +++ b/src/core/DOMEval.js @@ -3,12 +3,26 @@ define( [ ], function( document ) { "use strict"; - function DOMEval( code, doc ) { + var preservedScriptAttributes = { + type: true, + src: true, + noModule: true + }; + + function DOMEval( code, doc, node ) { doc = doc || document; - var script = doc.createElement( "script" ); + var i, + script = doc.createElement( "script" ); script.text = code; + if ( node ) { + for ( i in preservedScriptAttributes ) { + if ( node[ i ] ) { + script[ i ] = node[ i ]; + } + } + } doc.head.appendChild( script ).parentNode.removeChild( script ); } |