diff --git a/src/manipulation.js b/src/manipulation.js index 3b9aa1462..5f4b15dd9 100644 --- a/src/manipulation.js +++ b/src/manipulation.js @@ -390,8 +390,8 @@ function cloneCopyEvent(orig, ret) { 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 ); + for ( var i = 0, l = events[ type ].length; i < l; i++ ) { + jQuery.event.add( this, type, events[ type ][ i ], events[ type ][ i ].data ); } } } diff --git a/src/xhr.js b/src/xhr.js index 57903e046..4896e6cb6 100644 --- a/src/xhr.js +++ b/src/xhr.js @@ -87,7 +87,7 @@ jQuery.xhr = function( _native ) { } // Apply option prefilters - for (i in prefilters) { + for ( i = 0; i < prefilters.length; i++ ) { prefilters[i](s); } diff --git a/test/unit/manipulation.js b/test/unit/manipulation.js index ba57a6f91..da1635400 100644 --- a/test/unit/manipulation.js +++ b/test/unit/manipulation.js @@ -1,5 +1,8 @@ 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 functionReturningObj = function(value) { return (function() { return value; }); };