Skip to content
Permalink
Browse files
Added code to short-circuit a .each() loop.
  • Loading branch information
jeresig committed Oct 12, 2006
1 parent 96d429b commit edb54ef7334831d47591569316beb69e8ad717d6
Showing with 2 additions and 2 deletions.
  1. +2 −2 src/jquery/jquery.js
@@ -1384,10 +1384,10 @@ jQuery.extend({
each: function( obj, fn, args ) {
if ( obj.length == undefined )
for ( var i in obj )
fn.apply( obj[i], args || [i, obj[i]] );
if ( fn.apply( obj[i], args || [i, obj[i]] ) === false ) break;
else
for ( var i = 0; i < obj.length; i++ )
fn.apply( obj[i], args || [i, obj[i]] );
if ( fn.apply( obj[i], args || [i, obj[i]] ) === false ) break;
return obj;
},

0 comments on commit edb54ef

Please sign in to comment.