Skip to content

Commit ff88a02

Browse files
committed
jQuery.contains(): Clarify language.
Closes #213
1 parent 257173c commit ff88a02

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

entries/jQuery.contains.xml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,21 @@
77
<desc>The DOM element that may contain the other element.</desc>
88
</argument>
99
<argument name="contained" type="Element">
10-
<desc>The DOM element that may be contained by the other element.</desc>
10+
<desc>The DOM element that may be contained by (a descendant of) the other element.</desc>
1111
</argument>
1212
</signature>
13-
<desc>Check to see if a DOM element is within another DOM element.</desc>
13+
<desc>Check to see if a DOM element is a descendant of another DOM element.</desc>
1414
<longdesc>
15+
<p>The <code>$.contains()</code> method returns <code>true</code> if the DOM element provided by the second argument is a descendant of the DOM element provided by the first argument, whether it is a direct child or nested more deeply. Otherwise, it returns <code>false</code>. Only <em>element</em> nodes are supported; if the second argument is a text or comment node, <code>$.contains()</code> will return <code>false</code>.</p>
1516
<blockquote>
1617
<p><strong>Note:</strong> The first argument <em>must</em> be a DOM element, not a jQuery object or plain JavaScript object.</p>
1718
</blockquote>
1819
</longdesc>
1920
<example>
20-
<desc>Check if an element is inside another. Text and comment nodes are not supported.</desc>
21-
<code><![CDATA[jQuery.contains(document.documentElement, document.body); // true
22-
jQuery.contains(document.body, document.documentElement); // false]]></code>
21+
<desc>Check if an element is a descendant of another.</desc>
22+
<code><![CDATA[$.contains( document.documentElement, document.body ); // true
23+
$.contains( document.body, document.documentElement ); // false]]></code>
2324
</example>
2425
<category slug="utilities"/>
2526
<category slug="version/1.4"/>
26-
</entry>
27+
</entry>

0 commit comments

Comments
 (0)