Skip to content

Commit b37483b

Browse files
committed
Merge remote-tracking branch 'jmm-closest/jmm/closest' into closest
* jmm-closest/jmm/closest: Clarified that closest() returns 0 or 1 element /per original element/. Conflicts: entries/closest.xml
2 parents 9eba58d + ce171d6 commit b37483b

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

entries/closest.xml

+3-4
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,8 @@
2828
</argument>
2929
</signature>
3030

31-
<desc>Get the first element that matches the selector, beginning at the current element and progressing up through the DOM tree.</desc>
31+
<desc>For each element in the set, get the first element that matches the selector, by testing the element itself and traversing up through its ancestors in the DOM tree.</desc>
3232
<longdesc><p>Given a jQuery object that represents a set of DOM elements, the <code>.closest()</code> method searches through these elements and their ancestors in the DOM tree and constructs a new jQuery object from the matching elements. The <a href="/parents/"><code>.parents()</code></a> and <code>.closest()</code> methods are similar in that they both traverse up the DOM tree. The differences between the two, though subtle, are significant:</p>
33-
3433
<table>
3534
<thead>
3635
<tr>
@@ -47,8 +46,8 @@
4746
<td>Travels up the DOM tree to the document's root element, adding each ancestor element to a temporary collection; it then filters that collection based on a selector if one is supplied </td>
4847
</tr>
4948
<tr>
50-
<td>The returned jQuery object contains zero or one element</td>
51-
<td>The returned jQuery object contains zero, one, or multiple elements</td>
49+
<td>The returned jQuery object contains zero or one element for each element in the original set</td>
50+
<td>The returned jQuery object contains zero or more elements for each element in the original set</td>
5251
</tr>
5352
</tbody>
5453
</table>

0 commit comments

Comments
 (0)