Commit 5607bd8d authored by Colin Snover's avatar Colin Snover

Fix a potential error in the previous commit caused by the use of a separate...

Fix a potential error in the previous commit caused by the use of a separate index variable. Thanks to dmethvin for the review.
parent faefbb1a
...@@ -370,14 +370,18 @@ function root( elem, cur ) { ...@@ -370,14 +370,18 @@ function root( elem, cur ) {
} }
function cloneCopyEvent(orig, ret) { function cloneCopyEvent(orig, ret) {
var i = 0; ret.each(function (nodeIndex) {
if ( this.nodeType !== 1 || !jQuery.hasData(orig[nodeIndex]) ) {
ret.each(function() {
if ( this.nodeType !== 1 || this.nodeName !== (orig[i] && orig[i].nodeName) || !jQuery.hasData(orig[i]) ) {
return; 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) ), curData = jQuery.data( this, jQuery.extend(true, {}, oldData) ),
events = oldData && oldData.events; events = oldData && oldData.events;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment