[Greasemonkey] Weird GmScript error message

Bill Donnelly donnelly at snowcrest.net
Tue Aug 9 06:51:15 EDT 2005


In a discussion with the guy who wrote JS Lint, he pointed out something
I inquired about, thinking JS Lint was in error, and I guess he was right.

I originally had

   var unsafeWindow.gkwe_VK_CONTROL = false;
   var unsafeWindow.gkwe_VK_SHIFT = false;
   var unsafeWindow.gkwe_VK_ALT = false;
   var unsafeWindow.gkwe_VK_META = false;

   var unsafeWindow.gkwe_VK_KEYCODE = 0;
   var unsafeWindow.gkwe_VK_CHARCODE = 0;
   var unsafeWindow.gkwe_VK_ISCHAR = false;

He mentioned that it's not valid to have "var" in front of the assignment.
I disagreed, because unsafeWindow = window, but, I guess he was right.
I took off the var and it doesn't get errors now.

I guess I was thinking that, I am creating global window variables,
so it's okay to have var, but, technically, in this format, I guess it's not
really valid. I thought I had used "var window.whatever = something;",
but maybe I haven't. The correct format basically works the same as,
for example, "var gkwe_VK_CONTROL = false;" IF it was executing
in the global window scope.

Anyway, maybe I'm confused because I'm tired.

-- 
Sometimes bad things happen to good people.
When that happens, those good people should
seek out and find some bad people.
And then do something bad to them.
Just to even things out.
It's only fair, after all.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mozdev.org/pipermail/greasemonkey/attachments/20050809/02e69c1d/attachment.htm


More information about the Greasemonkey mailing list