This commit is contained in:
Jörn Zaefferer
2007-01-07 11:15:31 +00:00
parent 955fdb87a7
commit 46001b94f3

20
src/jquery/jquery.js vendored
View File

@@ -1165,15 +1165,21 @@ jQuery.extend({
/**
* A generic iterator function, which can be used to seemlessly
* iterate over both objects and arrays. This function is not the same
* as $().each() - which is used to iterate, exclusively, over a jQuery
* object. This function can be used to iterate over anything.
*
* iterate over both objects and arrays. This function is not the same
* as $().each() - which is used to iterate, exclusively, over a jQuery
* object. This function can be used to iterate over anything.
* alert( "Item #" + i + ": " + this );
* });
*
* The callback has two arguments:the key (objects) or index (arrays) as first
* the first, and the value as the second.
*
*
* @example $.each( [0,1,2], function(i, n){
* alert( "Item #" + i + ": " + n );
* });
* @desc This is an example of iterating over the items in an array,
* accessing both the current item and its index.
*
* @example $.each( { name: "John", lang: "JS" }, function(i, n){
* alert( "Name: " + i + ", Value: " + n );
* });
*
* @desc This is an example of iterating over the properties in an