Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Don't use for-in loops on Arrays. Fixes #7817. Thanks to dmethvin.

Conflicts:
	src/manipulation.js
  • Loading branch information...
commit 82ac384b494258e17e2856ee2259475ecb0174ca 2 parents f28c774 + acab4ab
@csnover csnover authored
Showing with 6 additions and 3 deletions.
  1. +2 −2 src/manipulation.js
  2. +1 −1  src/xhr.js
  3. +3 −0  test/unit/manipulation.js
View
4 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 );
}
}
}
View
2  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);
}
View
3  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; }); };
Please sign in to comment.
Something went wrong with that request. Please try again.