Skip to content

Commit 929f9e2

Browse files
committed
Types: add new type array-like object
Fixes jquerygh-708 Closes jquerygh-710
1 parent 473613d commit 929f9e2

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

pages/Types.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@
7373
<li class="toclevel-2"><a href="#Array.3CType.3E_Notation"><span class="toctext">Array&lt;Type&gt; Notation</span></a></li>
7474
</ul>
7575
</li>
76+
<li class="toclevel-1"><a href="#ArrayLikeObjects"><span class="toctext">Array-Like Objects</span></a></li>
7677
<li class="toclevel-1"><a href="#PlainObject"><span class="toctext">PlainObject</span></a></li>
7778
<li class="toclevel-1"><a href="#Date"><span class="toctext">Date</span></a></li>
7879
<li class="toclevel-1"><a href="#Function"><span class="toctext">Function</span></a>
@@ -411,6 +412,9 @@ <h3 id="Array.3CType.3E_Notation"> Array&lt;Type&gt; Notation </h3>
411412
</pre>
412413
<p>This indicates that the method doesn't only expect an array as the argument, but also specifies the expected type. The notation is borrowed from Java 5's generics notation (or C++ templates).
413414
</p>
415+
<h2 id="ArrayLikeObjects">Array-Like Objects</h2>
416+
<p>Either a true JavaScript Array or a JavaScript Object that contains a nonnegative integer <code>length</code> property and index properties from <code>0</code> up to <code>length - 1</code>. This latter case includes array-like objects commonly encountered in web-based code such as the <code>arguments</code> object and the <code>NodeList</code> object returned by many DOM methods.</p>
417+
<p>When a jQuery API accepts either plain Objects or Array-Like objects, a plain Object with a numeric <code>length</code> property will trigger the Array-Like behavior.</p>
414418
<h2 id="PlainObject"> PlainObject </h2>
415419
<p>The PlainObject type is a JavaScript object containing zero or more key-value pairs. The plain object is, in other words, an <code>Object</code> object. It is designated "plain" in jQuery documentation to distinguish it from other kinds of JavaScript objects: for example, <code>null</code>, user-defined arrays, and host objects such as <code>document</code>, all of which have a <code>typeof</code> value of "object." The <code><a href="/jQuery.isPlainObject/">jQuery.isPlainObject()</a></code> method identifies whether the passed argument is a plain object or not, as demonstrated below:
416420
</p>

0 commit comments

Comments
 (0)