2 ms·
So the issue is only with DOM elements in IE 6, right? If I write: function foo(huge) { some_global_thing.call_later = function() { 42 } } An
by jrockway 16y ago
So the issue is only with DOM elements in IE 6, right? If I write:
function foo(huge) {
some_global_thing.call_later = function() { 42 }
}
And call foo with "huge", huge is not saved in call_later's closure, right? And it doesn't change if I do:
function foo(huge, x){
blah_blah_blah.whatever = function() { x + 1 };
}
We're still only closing over "x", right?
- Twisol 16y agoUnfortunately, eval() complicates things. Consider: function foo (x) { return function(what) { return eval(what); }; } var theClosure = foo(42); var theX = theClosure("x"); document.write(theX); // displays 42 Even though "x" is never explicitly used, it's still accessible through the eval'd expression.