I am aware of this site not working properly. I am working on it!
MooTools
v0.4.6.0 beta
1

How to attach as an event handler a class method, and making sure that when I use the this in the event handler it will point to the class, and not to the DOM element I have attached the event to?

0

You need to "bind" the event handler to the Object you want it to run under. Basically, you are adding it again as a method to the class.
In the code it will look like that:

var X=new Class({
    initialize: function(){
        $('dom-elelemen-id').addEvent('click'.this.demoAlert.bind(this));
    },
    str: 'I am a property of THIS object',
    demoAlert:function(E){
        alert(this.str);//will alert "I am a property of THIS object"
    }
});

-2

<script>alert('hello');</script>

-2

click me!