Explicitly re-bind the events on clone. Copying over the data isn't enough. Fixes #5681.

This commit is contained in:
jeresig 2009-12-22 12:04:17 -05:00
parent 1ea539b4f0
commit 7d0c18034e

View file

@ -283,7 +283,18 @@ function cloneCopyEvent(orig, ret) {
return; return;
} }
jQuery.data( this, jQuery.data( orig[i++] ) ); var oldData = jQuery.data( orig[i++] ), curData = jQuery.data( this, oldData ), events = oldData.events;
if ( events ) {
delete curData.handle;
curData.events = {};
for ( var type in events ) {
for ( var handler in events[ type ] ) {
jQuery.event.add( this, type, events[ type ][ handler ], events[ type ][ handler ].data );
}
}
}
}); });
} }