Skip to content

Commit 9d03b37

Browse files
committed
Specified that jQuery.each accepts array-like objects
Closes jquerygh-1078 Fixes jquerygh-1032 Ref jquerygh-473
1 parent ca12161 commit 9d03b37

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

entries/jQuery.each.xml

+4-5
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
<title>jQuery.each()</title>
44
<signature>
55
<added>1.0</added>
6-
<argument name="array" type="Array">
7-
<desc>The array to iterate over.</desc>
6+
<argument name="array" type="ArrayLikeObject">
7+
<desc>The array or array-like object to iterate over.</desc>
88
</argument>
99
<argument name="callback" type="Function">
1010
<argument name="indexInArray" type="Integer" />
1111
<argument name="value" type="Object" />
12-
<desc>The function that will be executed on every object.</desc>
12+
<desc>The function that will be executed on every value.</desc>
1313
</argument>
1414
</signature>
1515
<signature>
@@ -20,13 +20,12 @@
2020
<argument name="callback" type="Function">
2121
<argument name="propertyName" type="String" />
2222
<argument name="valueOfProperty" type="Object" />
23-
<desc>The function that will be executed on every object.</desc>
23+
<desc>The function that will be executed on every value.</desc>
2424
</argument>
2525
</signature>
2626
<desc>A generic iterator function, which can be used to seamlessly iterate over both objects and arrays. Arrays and array-like objects with a length property (such as a function's arguments object) are iterated by numeric index, from 0 to length-1. Other objects are iterated via their named properties.</desc>
2727
<longdesc>
2828
<p>The <code>$.each()</code> function is not the same as <a href="/each/">$(selector).each()</a>, which is used to iterate, exclusively, over a jQuery object. The <code>$.each()</code> function can be used to iterate over any collection, whether it is an object or an array. In the case of an array, the callback is passed an array index and a corresponding array value each time. (The value can also be accessed through the <code>this</code> keyword, but Javascript will always wrap the <code>this</code> value as an <code>Object</code> even if it is a simple string or number value.) The method returns its first argument, the object that was iterated.</p>
29-
<p><b>Note:</b> The <code>$.each()</code> function internally retrieves and uses the <code>length</code> property of the passed collection. So, if the collection has a property called <code>length</code> — e.g. <code>{bar: 'foo', length: 10}</code> — the function might not work as expected.</p>
3029
<pre><code>
3130
$.each([ 52, 97 ], function( index, value ) {
3231
alert( index + ": " + value );

0 commit comments

Comments
 (0)