]> source.dussan.org Git - jquery.git/commitdiff
Explicitly re-bind the events on clone. Copying over the data isn't enough. Fixes...
authorjeresig <jeresig@gmail.com>
Tue, 22 Dec 2009 17:04:17 +0000 (12:04 -0500)
committerjeresig <jeresig@gmail.com>
Tue, 22 Dec 2009 17:04:17 +0000 (12:04 -0500)
src/manipulation.js

index 5109cf093b7e916e16bcc2883ca3b1e64653b288..27bc0b46b600cfdd032be6837eb78e40a4db41e7 100644 (file)
@@ -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 );
+                               }
+                       }
+               }
        });
 }