[Greasemonkey] GM-TNG - several bugs fixed
arantius at gmail.com
Wed Jul 27 10:47:55 EDT 2005
On 7/27/05, Bill Donnelly <donnelly at snowcrest.net> wrote:
> Isn't that the same thing?
(Note, I'm the author of GDB so I can rag on it ;-) )
No it's not the same.
> Doesn't the second way create a window global function foo,
> just like the first way?
>From what I understand, in GM-TNG, no it does not. unsafeWindow.foo() would.
> If not, what's the difference?
The existing way creates a function in the global namespace of the
page. The latter way assigns the function as a property of the
button, and litters nothing up.
> And how does the second reference know to call the correct
> foo function if it's not defined window globally?
Being assigned to the onclick function is simply a reference to it.
As for it being bad code, yes technically it is. I started out
polluting the global name space because earlier versions relied on a
setTimeout and I knew no other way to call the function besides
putting it in the global namespace. I'll have to work to make this
deer park compatible I imagine.
But aside from running it, with the GM 0.4.1 I downloaded yesterday,
and FF 1.0.6 the script would not even install. The download window
would pop up, but not the install script dialog. There was an error
which I posted in the other thread
More information about the Greasemonkey