Side navigation
#6993 closed enhancement (fixed)
Opened September 02, 2010 11:50PM UTC
Closed April 17, 2011 12:39AM UTC
.bind() and .one() don't allow a function as data
Reported by: | davidflanagan | Owned by: | john |
---|---|---|---|
Priority: | low | Milestone: | 1.6 |
Component: | event | Version: | 1.4.3 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
The .bind() and .one() methods take two or three arguments, and have the signatures:
bind(type, data, handler)
bind(type, handler)
Currently, jQuery 1.4.2 distinguishes these cases with this code:
if ( jQuery.isFunction( data ) ) {
fn = data;
data = undefined;
}
This means that if you pass a function as the data argument, it will be treated as the handler argument and the handler will be ignored.
I propose that you change the code to instead test like this:
if (arguments.length === 2) {
fn = data;
data = undefined;
}
Attachments (0)
Change History (5)
Changed September 02, 2010 11:51PM UTC by comment:1
Changed October 15, 2010 04:00AM UTC by comment:2
milestone: | 1.4.3 → 1.next |
---|---|
priority: | → low |
status: | new → open |
type: | bug → enhancement |
version: | 1.4.2 → 1.4.3 |
Changed October 19, 2010 01:07AM UTC by comment:3
milestone: | 1.4.4 → 1.5 |
---|
Retarget all enhancements/features to next major version.
Changed April 17, 2011 12:37AM UTC by comment:4
milestone: | → 1.6 |
---|---|
owner: | → john |
status: | open → assigned |
See line 2371 in jquery-1.4.2.js for the code referred to above. (It doesn't look right the way I pasted it into the ticket.)