diff options
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 ); } |