Don't want to bring this too back on topic, but please, please, don't
do this:
> var MyClass new Class({
> initialize: function(element){
> element.addEvent('click', function(){
> this.setStyle('color', 'red'); //here "this" points to the element,
> and can catch you of guard
> element.setStyle('color', 'red'); //much better; you don't need to
> use "this" here because you already have a pointer to the element
> });
> }
Referring to the element from the closure scope instead of the event
handler scope immediately results in terrible practice and can result
in a memory leak.
Luckily at least MT 1.2.x provides the .destroy() function to help
clean up messes like this, but I'm not so sure about 1.1.1.
Having the event handler be a member of the class and using a proper
binding technique like Class.Binds is much better.