Nope. Sorry, but the underlying browser stuff doesn''t allow it. If you use the W3C event model (multiple event handlers per event type per element), you can add listeners, and remove them by reference to the function, but there''s no way to iterate over the list of listeners, AFAIK. Prototype''s Event.observe() is essentially a cross-browser wrapper over Mozilla''s addEventListener() and IE''s attachEvent(), which are the implementations of the W3C event model. The best you could do is to hack Event.observe() and stopObserving() to maintain a list of listeners alongside the calls to the browser functions, which would work so long as you never called the browser functions directly. HTH Dave On Friday 31 August 2007 11:07, dave wrote:> Thanks, i know this method, but i need to remove all event handlers > for an element (without specifying a handler). Something like this: > YAHOO.util.Event.removeListener("myelementid", "click"); (http:// > developer.yahoo.com/yui/event/) > Because i don''t have reference to the event handlers attached to the > element before. > Or is possible to get references to all handlers for an element? > > On 31 Srp, 11:49, a.rebh...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote: > > http://www.prototypejs.org/api/event/stopObserving > > > > 2007/8/31, dave <daviddur...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>: > > > Hi, > > > is there some way to remove all event listeners for the specific > > > element? > > > Thanks for help. > >-- Author: Prototype & Scriptaculous in Action, Ajax in Practice, Ajax in Action --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Hi, is there some way to remove all event listeners for the specific element? Thanks for help. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
http://www.prototypejs.org/api/event/stopObserving 2007/8/31, dave <daviddurman-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>:> > > Hi, > is there some way to remove all event listeners for the specific > element? > Thanks for help. > > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Thanks, i know this method, but i need to remove all event handlers for an element (without specifying a handler). Something like this: YAHOO.util.Event.removeListener("myelementid", "click"); (http:// developer.yahoo.com/yui/event/) Because i don''t have reference to the event handlers attached to the element before. Or is possible to get references to all handlers for an element? On 31 Srp, 11:49, a.rebh...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote:> http://www.prototypejs.org/api/event/stopObserving > > 2007/8/31, dave <daviddur...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>: > > > > > Hi, > > is there some way to remove all event listeners for the specific > > element? > > Thanks for help.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
I''m not sure if this is possible with the current version. But my understanding is, that it would be possible with 1.6: *The event name and handler arguments to Event.stopObserving and Element#stopObserving are now optional*, so for a given element, you can now quickly unregister all its handlers, or unregister all handlers for a single event. I have not experience with it though. Alex http://www.prototypejs.org/2007/8/15/prototype-1-6-0-release-candidate 2007/8/31, dave <daviddurman-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>:> > > Thanks, i know this method, but i need to remove all event handlers > for an element (without specifying a handler). Something like this: > YAHOO.util.Event.removeListener("myelementid", "click"); (http:// > developer.yahoo.com/yui/event/) > Because i don''t have reference to the event handlers attached to the > element before. > Or is possible to get references to all handlers for an element? > > On 31 Srp, 11:49, a.rebh...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote: > > http://www.prototypejs.org/api/event/stopObserving > > > > 2007/8/31, dave <daviddur...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>: > > > > > > > > > Hi, > > > is there some way to remove all event listeners for the specific > > > element? > > > Thanks for help. > > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
On Aug 31, 7:45 pm, dave <daviddur...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi, > is there some way to remove all event listeners for the specific > element?If all browsers were to support DOM 3 Events, then yes: <URL: http://www.w3.org/TR/2001/WD-DOM-Level-3-Events-20010823/events.html#Events-EventListenerList>But you may have to wait some time before that is useful on the web :-) -- Rob --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---