Skip to content

Commit

Permalink
Explicitly re-bind the events on clone. Copying over the data isn't e…
Browse files Browse the repository at this point in the history
…nough. Fixes #5681.
  • Loading branch information
jeresig committed Dec 22, 2009
1 parent 1ea539b commit 7d0c180
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/manipulation.js
Expand Up @@ -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 );
}
}
}
});
}

Expand Down

0 comments on commit 7d0c180

Please sign in to comment.