Side navigation
#1140 closed bug (fixed)
Opened April 24, 2007 04:50AM UTC
Closed April 24, 2007 09:52PM UTC
Last modified June 21, 2007 04:53AM UTC
bind() incorrectly passes fn as data
Reported by: | arrix | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | 1.1.3 |
Component: | event | Version: | 1.1.2 |
Keywords: | event bind data | Cc: | |
Blocked by: | Blocking: |
Description
If you call $(selector).bind(type, fn), fn will be used as data. So event handlers checking for event.data presence will not works as expected.
e.g.
function handler(event) { if (event.data) { //gets executed even if no data was specified for bind() } else { //no data provided } }
In event.js,
bind: function( type, data, fn ) { return this.each(function(){ jQuery.event.add( this, type, fn || data, data ); }); },
The call to jQuery.event.add always passes the 3rd parameter.
patch