I don't understand following behaviour of jQuery 1.9.1 in Firefox 22.0, when following code (jsFiddle) does not produce ReferenceError as expected (not even in strict mode), but returns an object instead:
$("#press").click(function(){
console.log(press);
});
I'd like to read some documentation or explanation for this - is this something useful or should I avoid this? Why it does not overwrite variables inherited from outer scope?
I have no idea what to search for - is there a name for this feature? Or for this kind of objects that are pushed into handler function?
UPDATE - note that object press
is a different one from other global objects created from id
s - http://jsfiddle.net/Aprillion/BgsZn/2/:
$("html #outer #press").click(function(){
console.log(output);
console.log(outer);
console.log(press);
});
[14:23:02.632] [object HTMLDivElement]
[14:23:02.632] [object HTMLDivElement]
[14:23:02.632] ({jQuery19108414748019423938:2})