Commit 4424bda3 authored by Dave Methvin's avatar Dave Methvin

Use a for loop rather than for/in loop when copying events, so that code will...

Use a for loop rather than for/in loop when copying events, so that code will work with an augmented Array.prototype. Fixes 7809.
parent 291b1edf
...@@ -370,14 +370,14 @@ function root( elem, cur ) { ...@@ -370,14 +370,14 @@ function root( elem, cur ) {
} }
function cloneCopyEvent(orig, ret) { function cloneCopyEvent(orig, ret) {
var i = 0; var node = 0;
ret.each(function() { ret.each(function() {
if ( this.nodeType !== 1 || this.nodeName !== (orig[i] && orig[i].nodeName) ) { if ( this.nodeType !== 1 || this.nodeName !== (orig[node] && orig[node].nodeName) ) {
return; return;
} }
var oldData = jQuery.data( orig[i++] ), var oldData = jQuery.data( orig[node++] ),
curData = jQuery.data( this, oldData ), curData = jQuery.data( this, oldData ),
events = oldData && oldData.events; events = oldData && oldData.events;
...@@ -386,8 +386,8 @@ function cloneCopyEvent(orig, ret) { ...@@ -386,8 +386,8 @@ function cloneCopyEvent(orig, ret) {
curData.events = {}; curData.events = {};
for ( var type in events ) { for ( var type in events ) {
for ( var handler in events[ type ] ) { for ( var i = 0, l = events[ type ].length; i < l; i++ ) {
jQuery.event.add( this, type, events[ type ][ handler ], events[ type ][ handler ].data ); jQuery.event.add( this, type, events[ type ][ i ], events[ type ][ i ].data );
} }
} }
} }
......
module("manipulation"); module("manipulation");
// Ensure that an extended Array prototype doesn't break jQuery
Array.prototype.arrayProtoFn = function(arg) { throw("arrayProtoFn should not be called"); };
var bareObj = function(value) { return value; }; var bareObj = function(value) { return value; };
var functionReturningObj = function(value) { return (function() { return value; }); }; var functionReturningObj = function(value) { return (function() { return value; }); };
......
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