Why would you want the base? Olmo
On Oct 9, 8:49 am, "Nathan White" <[EMAIL PROTECTED]> wrote: > The reworking of class looks great. > > I realize that its best to use shallow inheritance in javascript for a > number of reason but on several occasions I have created a classes that are > extended 2-3 levels deep. I understand that this is not a common scenario > but in these situations I have had the need to refer to the 'base' method > and not the 'parent'. > > What do you think of the following code replacing line > 86-88<http://github.com/mootools/mootools-core/tree/master/Source/Class/Cla...> > . > > if (caller){ > object.parent = function(){ > return arguments.callee.caller.__parent.apply(this, arguments); > }; > > object.base = function(){ > var p = arguments.callee.caller; > while($type(p.__parent) == 'function') p = p.__parent; > return p.apply(this, arguments); > }; > }
