On Jul 17, 11:10 am, "Ryan Gahl" <[EMAIL PROTECTED]> wrote:
> When you do your stopObserving, you need to make sure you are passing the
> exact function handler you used when registering the event.
>
> var handler = function() { blah(); }.bindAsEventListener(this);
> Event.observe(someElement, "click", handler);
>
> ...later:
> Event.stopObserving(someElement, "click", handler);
>
> NOTE: this is not going to work:
> Event.observe(someElement, "click", function() {
> blah();}.bindAsEventListener(this));
>
> Event.stopObserving(someElement, "click", ???); //notice I don't have a
> handle to that anonymous function I defined above so I can't stop observing
> it
Actually handler and eventName are optional since 1.6.0.2.
#stopObserving will simply "detach" all handlers for eventName (when
no handler is specified) or for all events (when no event is
specified)
-- kangax
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Prototype: Core" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/prototype-core?hl=en
-~----------~----~----~----~------~----~------~--~---