diff options
author | Colin Snover <github.com@zetafleet.com> | 2010-12-22 09:13:28 -0600 |
---|---|---|
committer | Colin Snover <github.com@zetafleet.com> | 2010-12-22 09:14:53 -0600 |
commit | 5607bd8d53c5086bedb702f71dee02543cc7056a (patch) | |
tree | 75834bc7c99cf9c905604c667ea05e42081c0ef5 /src/manipulation.js | |
parent | faefbb1ad0b81e8001b582d06d5bd9c9236e62ce (diff) | |
download | jquery-5607bd8d53c5086bedb702f71dee02543cc7056a.tar.gz jquery-5607bd8d53c5086bedb702f71dee02543cc7056a.zip |
Fix a potential error in the previous commit caused by the use of a separate index variable. Thanks to dmethvin for the review.
Diffstat (limited to 'src/manipulation.js')
-rw-r--r-- | src/manipulation.js | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/manipulation.js b/src/manipulation.js index c23f62ed1..203d2ef72 100644 --- a/src/manipulation.js +++ b/src/manipulation.js @@ -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; |