Fixed use of eval() and new Function() to work within the correct scope (and not throw errors).
This commit is contained in:
parent
fc3e180465
commit
f2f399dcd5
2 changed files with 3 additions and 3 deletions
4
src/jquery/jquery.js
vendored
4
src/jquery/jquery.js
vendored
|
@ -1857,7 +1857,7 @@ jQuery.extend({
|
||||||
// If a string is passed in for the function, make a function
|
// If a string is passed in for the function, make a function
|
||||||
// for it (a handy shortcut)
|
// for it (a handy shortcut)
|
||||||
if ( typeof fn == "string" )
|
if ( typeof fn == "string" )
|
||||||
fn = eval("function(a,i){return " + fn + "}");
|
fn = eval("false||function(a,i){return " + fn + "}");
|
||||||
|
|
||||||
var result = [];
|
var result = [];
|
||||||
|
|
||||||
|
@ -1911,7 +1911,7 @@ jQuery.extend({
|
||||||
// If a string is passed in for the function, make a function
|
// If a string is passed in for the function, make a function
|
||||||
// for it (a handy shortcut)
|
// for it (a handy shortcut)
|
||||||
if ( typeof fn == "string" )
|
if ( typeof fn == "string" )
|
||||||
fn = eval("function(a){return " + fn + "}");
|
fn = eval("false||function(a){return " + fn + "}");
|
||||||
|
|
||||||
var result = [];
|
var result = [];
|
||||||
|
|
||||||
|
|
|
@ -405,7 +405,7 @@ jQuery.extend({
|
||||||
f = jQuery.expr[m[1]][m[2]];
|
f = jQuery.expr[m[1]][m[2]];
|
||||||
|
|
||||||
// Build a custom macro to enclose it
|
// Build a custom macro to enclose it
|
||||||
eval("f = function(a,i){return " + f + "}");
|
f = eval("false||function(a,i){return " + f + "}");
|
||||||
|
|
||||||
// Execute it against the current filter
|
// Execute it against the current filter
|
||||||
r = jQuery.grep( r, f, not );
|
r = jQuery.grep( r, f, not );
|
||||||
|
|
Loading…
Reference in a new issue