diff options
author | jeresig <jeresig@gmail.com> | 2009-12-22 12:04:17 -0500 |
---|---|---|
committer | jeresig <jeresig@gmail.com> | 2009-12-22 12:04:17 -0500 |
commit | 7d0c18034e1a7967c1aabc84e66e6fd020cd541d (patch) | |
tree | 12e6a64f42aed14440f58f99df4eabcdbc29a983 /src/manipulation.js | |
parent | 1ea539b4f08d9056e7e133173f7093908a513f77 (diff) | |
download | jquery-7d0c18034e1a7967c1aabc84e66e6fd020cd541d.tar.gz jquery-7d0c18034e1a7967c1aabc84e66e6fd020cd541d.zip |
Explicitly re-bind the events on clone. Copying over the data isn't enough. Fixes #5681.
Diffstat (limited to 'src/manipulation.js')
-rw-r--r-- | src/manipulation.js | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/manipulation.js b/src/manipulation.js index 5109cf093..27bc0b46b 100644 --- a/src/manipulation.js +++ b/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 ); + } + } + } }); } |