Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #4701 (closed enhancement: wontfix)

Opened 3 years ago

Last modified 2 years ago

Incorrect Implementation of Form.EventObserver and Form.Element.EventObserver

Reported by: Justin Palmer Assigned to: sam@conio.net
Priority: normal Milestone:
Component: Prototype Version: 1.1.1
Severity: normal Keywords: Form.EventObserver Form.Element.EventObserver
Cc: encytemedia@gmail.com

Description

After working with Form.EventObserver and Form.Element.EventObserver I wonder if they shouldn't pass the Event object to the callback, either in addition to the current arguments or by default.

If you want to get the element that fired an event using the Form.EventObserver, you end up having to compare data on every element which makes for a big mess.

If we passed the Event object this could easily be achieved and also preserve the original intent of the function.

Form.EventObserver('form', function(event, value) {
  var element = Event.element(event);
  var form  = Event.findElement(event, 'form');
  //Do other stuff
});

I think the intentions were maybe to follow the conventions of Abstract.TimedObserver, but this doesn't monitor native events and thus doesn't have an Event object being passed around.

Without access to the Event object the usefulness of both of these methods is fairly limited and it breaks from consistency with other native event based observers.

Is there any reason that I'm not aware of as to why the Event object isn't being passed to the callback?

-Cheers

Change History

04/12/06 01:50:23 changed by Justin Palmer

  • summary changed from Incorrect Implementation of Form.EventObserver to Incorrect Implementation of Form.EventObserver and Form.Element.EventObserver.

05/29/07 20:45:19 changed by josh

  • status changed from new to closed.
  • resolution set to wontfix.

Closing stale ticket. Please reopen if this is still an issue.