On Fri, Feb 18, 2011 at 4:00 AM, nathanJsweet <[email protected]>wrote:

> So in the new ECMA standard the body decided that when the "this" word
> is used at the highest hierarchical level (i.e. when it would normally
>

That is only the case in so called "strict mode".


> be the window object) would be undefined. In using the MooTools
> library I have noticed that they invoke all of their IIFEs by tying
> the variables to the "this" word instead of passing the window object
> to the function and tying the variables into the window object that
> way (as JQuery does). My question is: should I be worried? I'm tempted
> to go through MooTools when I'm finished building with it for a
> particular website and replace the cases where the "this" word is used
> for window with an invocation variable that is being passed the window
> object, like so: (function(w){ var someVar = w.someVar = function()
> {dosomething}})(window);. What do you all thing?
>

I imagine (but not sure) that they're using this rather than window to allow
you to create a local namespace. The easy fix for them would be
(this||window).

As for you, the user. As long as you don't have any "use strict" headers in
your global space (or if you don't concat) you should not be worried. I'd
expect MooTools to release a fix for it but have no idea how active it's
being developed currently.

- peter

-- 
To view archived discussions from the original JSMentors Mailman list: 
http://www.mail-archive.com/[email protected]/

To search via a non-Google archive, visit here: 
http://www.mail-archive.com/[email protected]/

To unsubscribe from this group, send email to
[email protected]

Reply via email to