]> source.dussan.org Git - jquery.git/commitdiff
Fix a potential error in the previous commit caused by the use of a separate index...
authorColin Snover <github.com@zetafleet.com>
Wed, 22 Dec 2010 15:13:28 +0000 (09:13 -0600)
committerColin Snover <github.com@zetafleet.com>
Wed, 22 Dec 2010 15:14:53 +0000 (09:14 -0600)
src/manipulation.js

index c23f62ed19c732a3d7e411ff18822e70dadb7510..203d2ef725bbb02e05f2d2217097a77eee15faf6 100644 (file)
@@ -370,14 +370,18 @@ function root( elem, cur ) {
 }
 
 function cloneCopyEvent(orig, ret) {
-       var i = 0;
-
-       ret.each(function() {
-               if ( this.nodeType !== 1 || this.nodeName !== (orig[i] && orig[i].nodeName) || !jQuery.hasData(orig[i]) ) {
+       ret.each(function (nodeIndex) {
+               if ( this.nodeType !== 1 || !jQuery.hasData(orig[nodeIndex]) ) {
                        return;
                }
 
-               var oldData = jQuery.data( orig[i++] ),
+               // XXX remove for 1.5 RC or merge back in if there is actually a reason for this check that has been
+               // unexposed by unit tests
+               if ( this.nodeName !== (orig[nodeIndex] && orig[nodeIndex].nodeName) ) {
+                       throw "Cloned data mismatch";
+               }
+
+               var oldData = jQuery.data( orig[nodeIndex] ),
                        curData = jQuery.data( this, jQuery.extend(true, {}, oldData) ),
                        events = oldData && oldData.events;