Side navigation
#13993 closed bug (fixed)
Opened June 05, 2013 03:02PM UTC
Closed October 07, 2013 01:30AM UTC
.triggerHandler doesn't return value from handler for DOM0 events
Reported by: | onovy | Owned by: | dmethvin |
---|---|---|---|
Priority: | low | Milestone: | 1.11/2.1 |
Component: | event | Version: | 1.10.1 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
According to documentation (http://api.jquery.com/triggerHandler/) .triggerHandler should return value returned by event handler:
''Instead of returning the jQuery object (to allow chaining), .triggerHandler() returns whatever value was returned by the last handler it caused to be executed. If no handlers are triggered, it returns undefined.''
But when you add event handler using DOM0 method (onXY attribute), .triggerHandler returns 'undefined' everytime. Doesn't matter what you return from handler function.
Tested in browsers: Chrome/Firefox
jQuery version: 1.10 / 1.10.1
Test case: http://jsbin.com/atofap/3/edit
In console is:
click1
undefined
click2
false
Should be:
click1
false
click2
false
Attachments (0)
Change History (3)
Changed June 05, 2013 03:40PM UTC by comment:1
component: | unfiled → event |
---|---|
milestone: | None → 1.11/2.1 |
priority: | undecided → low |
status: | new → open |
Changed September 17, 2013 02:16PM UTC by comment:2
owner: | → dmethvin |
---|---|
status: | open → assigned |
Changed October 07, 2013 01:30AM UTC by comment:3
resolution: | → fixed |
---|---|
status: | assigned → closed |
We've never fully supported inline handers but this looks easy enough to fix.
https://github.com/jquery/jquery/blob/8643ac77fbd7508651639a41eced5338c1738c12/src/event.js#L300