On Feb 20, 2008 11:52 AM, Mike Wilson <
mikewse@...> wrote:
Well, if people start putting their scripts at the
bottom of the page it may be better to go back to the var syntax. That
would take away |this| or |window| completely so I guess then we don't
have to choose between them :-).
What's the reason for using a |this.| or |window.|
prefix anyway? (more than clarity
I was banging my head against the var problem, and thinking that sometimes this != window, so I copied Dojo and everything worked, however this was down to me doing the same thing everywhere.
However if a system similar to Jaxer uses DWR for remoting then there may be no window object. So there is something to be gained by using |this|, however I agree with the point about clarity.
I think the only reason I'm not jumping to go back to var, is not liking it's use in a global context, and not liking it's interaction with IE. But the script-at-the-bottom argument does tend to overrule that a bit. Hmmm
I guess a possible risk would be scenarious where bugs
or misuse makes our |var| register in the wrong context,
something along the lines of IE eval's global context
limitations, if DWR would f ex be included through a package system that doesn't
know about IE's execScript.
For reference, Prototype uses the |var| syntax and
Dojo uses |this.|.
Joe