What are the pros and cons of using Event.observe vs. element.onxxx = 
somefunction ?

I noticed that a lot of sau code doesn't use Event.observe. For example, 
InPlaceEditor uses
    this.form.onsubmit = this.onSubmit.bind(this);

In my code I've made a habit of using the equivalent (for example):
    this.onSubmitListener = this.onSubmit.bind(this);
    Event.observe(this.form,'submit',this.onSubmitListener);
So that in my "dispose" methods I can cleanup properly by calling:
    Event.stopObserving(this.form,'submit',this.onSubmitListener);

Am I just wasting my time? Is the Prototype method more or less 
leak-prone than the .onxxx = function method?

Thanks,
Colin


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to