-
Notifications
You must be signed in to change notification settings - Fork 265
/
Copy pathjQuery.contains.xml
29 lines (29 loc) · 1.47 KB
/
jQuery.contains.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?xml version="1.0"?>
<entry type="method" name="jQuery.contains" return="Boolean">
<title>jQuery.contains()</title>
<signature>
<added>1.4</added>
<argument name="container" type="Element">
<desc>The DOM element that may contain the other element.</desc>
</argument>
<argument name="contained" type="Element">
<desc>The DOM element that may be contained by (a descendant of) the other element.</desc>
</argument>
</signature>
<desc>Check to see if a DOM element is a descendant of another DOM element.</desc>
<longdesc>
<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>
<div class="warning">
<p><strong>Note:</strong> The first argument <em>must</em> be a DOM element, not a jQuery object or plain JavaScript object.</p>
</div>
</longdesc>
<example>
<desc>Check if an element is a descendant of another.</desc>
<code><![CDATA[
$.contains( document.documentElement, document.body ); // true
$.contains( document.body, document.documentElement ); // false
]]></code>
</example>
<category slug="utilities"/>
<category slug="version/1.4"/>
</entry>