I didn't realize that your question was centered around the fact that
your events were still being observed. I just thought you wanted to
know what the deal was with the observers array.

As stated above, you cannot remove events that you attached with an
anonymous function. References:

http://joseph.randomnetworks.com/archives/2006/08/01/javascript-events-with-prototype/
http://www.andrewdupont.net/2006/05/07/undecidability-of-equivalence-or-the-pitfalls-of-advanced-event-listening/

With that in mind, when you stopObserving the event, it STILL will not
be removed from Event.observers for all the reasons I described in my
initial email to you. Event.observers merely exists to store all of
the initially observed events for IE memory leak correction. Events
are added to Event.observers when you call Event.observe(), but they
play no role in determining event management. Event.observers is
cleared on unload if you're using IE. That is all it does.

Pretty much completely disregard Event.observers as it will never
(unless you're doing some REALLY next-level stuff) play any role in
your development.

But yeah, stay away from anonymous functions if there is any chance
you'll ever want to remove that event observation.

-E

On 12/14/06, heidmotron <[EMAIL PROTECTED]> wrote:
>
> martin: excellent catch!
> I didn't even notice that the code would still fire even because i was
> passing an anonymous function through stop observing.
> A little arrogance and stupidity on my part, I was like 'whatever I use
> bind method for most of my method calls'
> Duh it returns anonymous function.
>
> still doesn't answer the question about the array size.
>
> But once again thanks for an excellent catch
>
>
> >
>


-- 
Eric Ryan Harrison

--~--~---------~--~----~------------~-------~--~----~
 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 [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to