diff --git a/src/core.js b/src/core.js index 028d0ac02..9dacc48a8 100644 --- a/src/core.js +++ b/src/core.js @@ -275,17 +275,18 @@ jQuery.extend({ }, // Evaluates a script in a global context - // Workarounds based on findings by Jim Driscoll - // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context globalEval: function( data ) { - if ( data && jQuery.trim( data ) ) { - // We use execScript on Internet Explorer - // We use an anonymous function so that context is window - // rather than jQuery in Firefox - ( window.execScript || function( data ) { - window[ "eval" ].call( window, data ); - } )( data ); - } + // Inspired by code by Andrea Giammarchi + // http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html + var head = document.head || jQuery( "head" )[ 0 ] || document.documentElement, + script = document.createElement( "script" ); + + script.text = data; + + // Support: IE6 + // Circumvent bugs with base elements (#2709 and #4378) by prepending + head.insertBefore( script, head.firstChild ); + head.removeChild( script ); }, // Convert dashed to camelCase; used by the css and data modules diff --git a/test/data/event/syncReady.html b/test/data/event/syncReady.html index e0885707e..0d2f8fdad 100644 --- a/test/data/event/syncReady.html +++ b/test/data/event/syncReady.html @@ -8,7 +8,7 @@
@@ -17,7 +17,7 @@ jQuery( document ).ready(function () { oldIE into thinking the dom is ready, but it's not... leaving this check here for future trailblazers to attempt fixing this...--> - +