Re: [greasemonkey-users] What does (function(){...})(); mean in Greasemonkey?

2010-03-12 Thread Ruben Rodriguez cha0s
On 03/09/2010 11:44 PM, Dave Land wrote: On Mar 9, 2010, at 9:18 PM, Aleksandr Rainchik wrote: Hello! I've seen some scripts at userscripts.org that start and end in this way: // ==UserScript== // blah.. // blah.. // ==/UserScript== (function() { blah... blah... })(); Why would

Re: [greasemonkey-users] What does (function(){...})(); mean in Greasemonkey?

2010-03-12 Thread Dave Land
On Mar 9, 2010, at 9:48 PM, Ruben Rodriguez wrote: On 03/09/2010 11:44 PM, Dave Land wrote: On Mar 9, 2010, at 9:18 PM, Aleksandr Rainchik wrote: Why would someone want to enclose the code with this (function() {...}) (); ? What does it actually do? If I'm mistaken in how I've

[greasemonkey-users] What does (function(){...})(); mean in Greasemonkey?

2010-03-09 Thread Aleksandr Rainchik
Hello! I've seen some scripts at userscripts.org that start and end in this way: // ==UserScript== // blah.. // blah.. // ==/UserScript== (function() { blah... blah... })(); Why would someone want to enclose the code with this (function(){...}) (); ? What does it actually do? Thank

Re: [greasemonkey-users] What does (function(){...})(); mean in Greasemonkey?

2010-03-09 Thread Dave Land
On Mar 9, 2010, at 9:18 PM, Aleksandr Rainchik wrote: Hello! I've seen some scripts at userscripts.org that start and end in this way: // ==UserScript== // blah.. // blah.. // ==/UserScript== (function() { blah... blah... })(); Why would someone want to enclose the code with this

Re: [greasemonkey-users] What does (function(){...})(); mean in Greasemonkey?

2010-03-09 Thread Dave Land
On Mar 9, 2010, at 9:44 PM, Dave Land wrote: The anonymous function wrapper ensures that the script's identifiers don't collide with identifiers in JavaScript in the page itself. All of the script's identifiers exist only within the anonymous function, so they can't leak out into the page,

Re: [greasemonkey-users] What does (function(){...})(); mean in Greasemonkey?

2010-03-09 Thread cc
On 2010-03-09 22:12, Dave Land wrote: On Mar 9, 2010, at 9:44 PM, Dave Land wrote: The anonymous function wrapper ensures that the script's identifiers don't collide with identifiers in JavaScript in the page itself. All of the script's identifiers exist only within the anonymous function,