diff options
author | Oleg Gaidarenko <markelog@gmail.com> | 2013-11-29 12:15:05 +0400 |
---|---|---|
committer | Oleg Gaidarenko <markelog@gmail.com> | 2014-06-16 03:08:46 +0400 |
commit | bbdfbb4ee859fe9319b348d88120ddc2c9efbd63 (patch) | |
tree | e1414009afea419718e875dfc85deec8f3558d23 /src/core.js | |
parent | e488d985cfb10ab8c684bbc6a9b8ff3eae23bf83 (diff) | |
download | jquery-bbdfbb4ee859fe9319b348d88120ddc2c9efbd63.tar.gz jquery-bbdfbb4ee859fe9319b348d88120ddc2c9efbd63.zip |
Ajax: Always use script injection in globalEval
Fixes #14757
Closes gh-1449
Diffstat (limited to 'src/core.js')
-rw-r--r-- | src/core.js | 23 |
1 files changed, 4 insertions, 19 deletions
diff --git a/src/core.js b/src/core.js index da6aa833a..15e2077aa 100644 --- a/src/core.js +++ b/src/core.js @@ -256,25 +256,10 @@ jQuery.extend({ // Evaluates a script in a global context globalEval: function( code ) { - var script, - indirect = eval; - - code = jQuery.trim( code ); - - if ( code ) { - // If the code includes a valid, prologue position - // strict mode pragma, execute code by injecting a - // script tag into the document. - if ( code.indexOf("use strict") === 1 ) { - script = document.createElement("script"); - script.text = code; - document.head.appendChild( script ).parentNode.removeChild( script ); - } else { - // Otherwise, avoid the DOM node creation, insertion - // and removal by using an indirect global eval - indirect( code ); - } - } + var script = document.createElement( "script" ); + + script.text = code; + document.head.appendChild( script ).parentNode.removeChild( script ); }, // Convert dashed to camelCase; used by the css and data modules |