mirror of
https://github.com/jquery/jquery.git
synced 2026-02-11 01:05:14 -05:00
Manipulation: execute scripts from iframe in the iframe's context
Fixes gh-1757 Close gh-2696
This commit is contained in:
@@ -258,11 +258,12 @@ jQuery.extend( {
|
||||
},
|
||||
|
||||
// Evaluates a script in a global context
|
||||
globalEval: function( code ) {
|
||||
var script = document.createElement( "script" );
|
||||
globalEval: function( code, context ) {
|
||||
context = context || document;
|
||||
var script = context.createElement( "script" );
|
||||
|
||||
script.text = code;
|
||||
document.head.appendChild( script ).parentNode.removeChild( script );
|
||||
context.head.appendChild( script ).parentNode.removeChild( script );
|
||||
},
|
||||
|
||||
// Convert dashed to camelCase; used by the css and data modules
|
||||
|
||||
@@ -192,7 +192,7 @@ function domManip( collection, args, callback, ignored ) {
|
||||
jQuery._evalUrl( node.src );
|
||||
}
|
||||
} else {
|
||||
jQuery.globalEval( node.textContent.replace( rcleanScript, "" ) );
|
||||
jQuery.globalEval( node.textContent.replace( rcleanScript, "" ), doc );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user