Side navigation
#2223 closed bug (invalid)
Opened January 23, 2008 04:28PM UTC
Closed January 15, 2009 03:30AM UTC
Last modified March 15, 2012 10:17AM UTC
triggerHandler triggers only on the first selected element
Reported by: | joern | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | 1.2.4 |
Component: | event | Version: | 1.2.2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
For some reason triggerHandler triggers handlers only on the first selected element. As I see no apparent reason for that behaviour, and the docs say nothing about it, I consider it a bug.
Actually the docs say triggerHandler would reuturn a jQuery object, which it doesn't.
The obvious patch would be to add the usual each:
triggerHandler: function( type, data, fn ) { return this.each(function(){ jQuery.event.trigger( type, data, this, false, fn ); }); },
I'm rather sure there is something else behind this...
I think the behavior is intended and the docs are just misleading. triggerHandler currently returns the value returned by the handlers (for the first element). Obviously the current implementation and the suggested implementation are both useful.
I use the current implementation in the webforms plugin as:
However, this could be accomplished using internal jQuery code as:
I would assume that other developers are taking advantage of the current return value as well.