On Sat, 31 Jan 2009 22:47:24 +0100
Sébastien Gruhier <sgruh...@gmail.com> wrote:

> You have to bind event handler to 'this'
>      document.observe('mousemove',
> this.storeMousePosition.bind(this));
> $('testDiv').observe('mouseover', this.checkAndTell.bind(this));
> Seb

This worked thanks :)

But now i've got a question. The documentation pdf says about the
observe method of the Event class, that "Starting in Prototype 1.6,
Event handlers registered with observe are automatically bound to the
event’s target element in all browsers. This means that by default,
this in an event handler refers to the element that fired the event."

I'm using prototype, so if i'm not wrong, the call to
handler.bind(this) shouldn't be needed. Since it does not work
without that call, i'm obviously wrong. So: what the docs mean?


You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
For more options, visit this group at 

Reply via email to