Commit edb54ef7 authored by John Resig's avatar John Resig

Added code to short-circuit a .each() loop.

parent 96d429b9
......@@ -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;
},
......
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