It may or may not work, but you could try this: Event.stopObserving(element, element.onclick);
Etc, etc, etc. The element.onclick *should* return the anonymous function ref, but it may not work in all browsers. You'd have to do that for each event and each element, though. Greg > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:rails-spinoffs- > [EMAIL PROTECTED] On Behalf Of Cam McVey > Sent: Wednesday, January 18, 2006 12:23 PM > To: [email protected] > Subject: [Rails-spinoffs] Event.stopObserving and anonymous functions > > Hi all, > > I'm using behaviour(.js) to add event handlers to all the table cells > in a table (mouseover, mouseout, clickk). However, I'm also ditching > the table and replacing it with an Ajax.Updater so I want to remove > all the observers before I lose them. Unfortunately, the Event.observe > calls were written as inline anonymous functions so, when calling > Event.stopObserving, I'm supposed to pass in a reference to the > observer function, but it isn't able to be referenced as far as I > know. > > I'd use Event.unloadCache() as a brute-force solution, but there are a > ton of other observers for other areas of the page that would all have > to be re-created. > > Is there a way around this (keeping the 'observers' as anonymous > functions), or a better way to approach this? > > (Why do these things always crop up the night before The Big Demo?) > > Many many thanks! > -- > > Cam McVey > [EMAIL PROTECTED] _______________________________________________ Rails-spinoffs mailing list [email protected] http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
