Merge branch 'master' of github.com:jquery/jquery
This commit is contained in:
commit
c470db6950
8 changed files with 550 additions and 334 deletions
27
src/core.js
27
src/core.js
|
@ -565,24 +565,17 @@ jQuery.extend({
|
|||
|
||||
noop: function() {},
|
||||
|
||||
// Evalulates a script in a global context
|
||||
// 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 && rnotwhite.test(data) ) {
|
||||
// Inspired by code by Andrea Giammarchi
|
||||
// http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html
|
||||
var head = document.head || document.getElementsByTagName( "head" )[0] || document.documentElement,
|
||||
script = document.createElement( "script" );
|
||||
|
||||
if ( jQuery.support.scriptEval() ) {
|
||||
script.appendChild( document.createTextNode( data ) );
|
||||
} else {
|
||||
script.text = data;
|
||||
}
|
||||
|
||||
// Use insertBefore instead of appendChild to circumvent an IE6 bug.
|
||||
// This arises when a base node is used (#2709).
|
||||
head.insertBefore( script, head.firstChild );
|
||||
head.removeChild( script );
|
||||
if ( data && rnotwhite.test( 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 );
|
||||
}
|
||||
},
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue