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
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
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
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
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,
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,