I feel comfortable with the internals of mootools for the most part and love
reading the code. However in 1.2.0 there is a bit of code that perplexes
me.  I donno if I'm missing something or what. I figured I would ask for
some help or clarification. I will note that in the nightly builds this code
has been completely replaced with something that seems a bit more robust.

In the Core.js file line 103-108

(function(object, methods){
    for (var i = methods.length; i--; i) Native.genericize(object,
methods[i], true);
    return arguments.callee;
})
(Array, ['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift',
'concat', 'join', 'slice', 'toString', 'valueOf', 'indexOf', 'lastIndexOf'])
(String, ['charAt', 'charCodeAt', 'concat', 'indexOf', 'lastIndexOf',
'match', 'replace', 'search', 'slice', 'split', 'substr', 'substring',
'toLowerCase', 'toUpperCase', 'valueOf']);


I understand and recognize the anonymous function syntax (function(){})()
but what I don't get is how the it appears the params are passed twice to
the same anonymous function. The (Array...) followed by the (String...);
doesn't makes sense to me. If I take this snippet of code out by itself
modifying the internal function for generic debugging info it breaks. It
handles the Array () fine but it gets to the String () and breaks.

I looked above in the code to see if I was missing some other closure but I
didn't see anything.

Can anyone shed any light on this, and why it works?

Reply via email to