#8858 closed enhancement (fixed)
Special events - _default method doesn't have access to the `data` argument of the trigger method
Reported by: | centi | Owned by: | dmethvin |
---|---|---|---|
Priority: | blocker | Milestone: | 1.7 |
Component: | event | Version: | 1.5.2 |
Keywords: | 1.7-discuss | Cc: | |
Blocked by: | Blocking: |
Description (last modified by )
The trigger method has an optional second argument data
which is passed to all event handlers bound to the particular event which was triggered.
We can use special events, to define the behavior of our custom events, including a _default method. I would expect that this _default method will have access to the data
argument, like the event handlers. But it doesn't.
jQuery source, line 2501:
if ( (!special._default || special._default.call( elem, event ) === false) &&
Suggested fix
if ( (!special._default || special._default.call( elem, event, data ) === false) &&
Change History (14)
comment:1 Changed 12 years ago by
Component: | unfiled → event |
---|---|
Priority: | undecided → low |
comment:2 Changed 12 years ago by
Status: | new → open |
---|
comment:4 Changed 12 years ago by
Description: | modified (diff) |
---|
+1, Seems like a bug, should be fixed
comment:11 Changed 12 years ago by
Milestone: | 1.next → 1.7 |
---|---|
Owner: | set to dmethvin |
Priority: | low → blocker |
Status: | open → assigned |
comment:12 Changed 12 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Fixes #8858. Pass the .trigger(..., data) to the event.special._default method.
Changeset: 0dc7b16e94ebb6ad27bcf8f12d62efac7d610db5
comment:13 Changed 12 years ago by
Feels weird to me to have an alternative signature for the _default event vs. the regular ones. Submitted a patch @ https://github.com/jquery/jquery/pull/549 to fix this.
comment:14 Changed 12 years ago by
Landed Mikael's better solution here: https://github.com/jquery/jquery/commit/df4a160be7fcc234a8e17eccb1c3fd02f231bcfc
Let's get this in 1.7.