X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=src%2Fjquery%2Fjquery.js;h=440e20e98483a4d1b317b7323c7b044541b322a1;hb=6b0d3bb273f09910921ed84539de06c2e7ecd19b;hp=a0a20099327d118cb8b34c6ac3249ce7d752ff6d;hpb=334462b23c3daca53f2fbff177693f0f1ba29c48;p=jquery.git diff --git a/src/jquery/jquery.js b/src/jquery/jquery.js index a0a2009..440e20e 100644 --- a/src/jquery/jquery.js +++ b/src/jquery/jquery.js @@ -1191,7 +1191,7 @@ jQuery.fn = jQuery.prototype = { if ( this.src ) jQuery.ajax({ url: this.src, async: false, dataType: "script" }); else - (new Function( this.text || this.textContent || this.innerHTML || "" ))(); + jQuery.globalEval( this.text || this.textContent || this.innerHTML || "" ); } else fn.apply( obj, [ clone ? this.cloneNode(true) : this ] ); }); @@ -1322,6 +1322,21 @@ jQuery.extend({ elem.tagName && elem.ownerDocument && !elem.ownerDocument.body; }, + // Evalulates a script in a global context + // Evaluates Async. in Safari 2 :-( + globalEval: function( data ) { + data = jQuery.trim( data ); + if ( data ) { + if ( window.execScript ) + window.execScript( data ); + else if ( jQuery.browser.safari ) + // safari doesn't provide a synchronous global eval + window.setTimeout( data, 0 ); + else + eval.call( window, data ); + } + }, + nodeName: function( elem, name ) { return elem.nodeName && elem.nodeName.toUpperCase() == name.toUpperCase(); },