Bug Tracker

Ticket #7968 (closed bug: invalid)

Opened 4 years ago

Last modified 4 years ago

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:
Blocking: Blocked by:

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.

Change History

comment:1 Changed 4 years ago by jitter

  • Priority changed from undecided to low
  • Resolution set to invalid
  • Status changed from new to closed
  • Component changed from unfiled to event

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  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.

Version 0, edited 4 years ago by jitter (next)

comment:2 Changed 4 years ago by frizz

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.

Note: See TracTickets for help on using tickets.