Skip to main content

Bug Tracker

Side navigation

#7968 closed bug (invalid)

Opened January 14, 2011 05:16AM UTC

Closed January 14, 2011 11:20PM UTC

Last modified January 15, 2011 03:33AM UTC

Can't specify false as .bind() eventData parameter

Reported by: frizz Owned by:
Priority: low Milestone: 1.next
Component: event Version: 1.4.3
Keywords: Cc:
Blocked by: Blocking:
Description

The false gets picked up as the new return false handler shortcut and the handler parameter is ignored.

Super-simple example here. Should open alert, but doesn't. Works in jQuery 1.4.2.

Attachments (0)
Change History (2)

Changed January 14, 2011 11:20PM UTC by jitter comment:1

_comment0: Thanks for taking the time to contribute to the jQuery project by writing a bug report and providing a test case! \ \ This is no bug in jQuery but a misunderstanding on how the `eventData` parameter to the `.bind()` method can be used. The [http://api.jquery.com/bind bind() documentation] says: \ > '''eventData''' A '''map''' of data that will be passed to the event handler. \ From this it should become apparent that the `eventData` parameter needs to be a map of data and thus can not be a primitive value like `false`. \ \ This [http://jsfiddle.net/jitter/bqgUh/ live test case] shows a usage of the `eventData` parameter which follows the documentation and works as expected.1295047277354466
component: unfiledevent
priority: undecidedlow
resolution: → invalid
status: newclosed

Thanks for taking the time to contribute to the jQuery project by writing a bug report and providing a test case!

This is no bug in jQuery but a misunderstanding on how the eventData parameter can be used. The bind() documentation says:

eventData A map of data that will be passed to the event handler.

From this it should become apparent that the eventData parameter needs to be a map of data and thus can not be a primitive value like false. This live test case shows a usage of the eventData parameter which follows the documentation and works as expected.

Changed January 15, 2011 03:33AM UTC by frizz comment:2

Thanks for the correction. Looks like I've been using bind() incorrectly for a while now, and it only became a problem after I upgraded from 1.3.2.