Make sure multiple bound events have their namespaces and data maintained. Fixes #3549.

This commit is contained in:
jeresig 2010-01-25 16:45:39 -05:00
parent e01ff6cda1
commit 0474917c9d
2 changed files with 46 additions and 3 deletions

View file

@ -71,19 +71,28 @@ jQuery.event = {
// Handle multiple events separated by a space
// jQuery(...).bind("mouseover mouseout", fn);
types = types.split( /\s+/ );
var type, i=0;
var type, i = 0;
while ( (type = types[ i++ ]) ) {
// Namespaced event handlers
var namespaces = type.split(".");
type = namespaces.shift();
if ( i > 1 ) {
handler = jQuery.proxy( handler );
if ( data !== undefined ) {
handler.data = data;
}
}
handler.type = namespaces.slice(0).sort().join(".");
// Get the current list of functions bound to this event
var handlers = events[ type ],
special = this.special[ type ] || {};
// Init the event handler queue
if ( !handlers ) {
handlers = events[ type ] = {};