aboutsummaryrefslogtreecommitdiffstats
path: root/src/core.js
diff options
context:
space:
mode:
authorTimmy Willison <timmywillisn@gmail.com>2015-11-06 18:36:38 -0500
committerTimmy Willison <timmywillisn@gmail.com>2015-11-09 14:14:30 -0500
commit22449eb968622c2e14d6c8d8de2cf1e1ba4adccd (patch)
treea10fbbc33d0eb7799b67f1b441459a3e59419da2 /src/core.js
parent67fa2eab6ef323b1d894e9e7f054c6e8c844d304 (diff)
downloadjquery-22449eb968622c2e14d6c8d8de2cf1e1ba4adccd.tar.gz
jquery-22449eb968622c2e14d6c8d8de2cf1e1ba4adccd.zip
Manipulation: execute scripts from iframe in the iframe's context
Fixes gh-1757 Close gh-2696
Diffstat (limited to 'src/core.js')
-rw-r--r--src/core.js7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/core.js b/src/core.js
index 8e43547ac..9095213eb 100644
--- a/src/core.js
+++ b/src/core.js
@@ -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