Skip to content
Permalink
Browse files

Explicitly re-bind the events on clone. Copying over the data isn't e…

…nough. Fixes #5681.
  • Loading branch information
jeresig committed Dec 22, 2009
1 parent 1ea539b commit 7d0c18034e1a7967c1aabc84e66e6fd020cd541d
Showing with 12 additions and 1 deletion.
  1. +12 −1 src/manipulation.js
@@ -283,7 +283,18 @@ function cloneCopyEvent(orig, ret) {
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 );
}
}
}
});
}

0 comments on commit 7d0c180

Please sign in to comment.
You can’t perform that action at this time.