/
has-selector.xml
29 lines (28 loc) · 1.24 KB
/
has-selector.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="selector" name="has" return="">
<title>:has() Selector</title>
<sample>:has(selector)</sample>
<signature>
<added>1.1.4</added>
<argument name="selector" type="Selector">
<desc>Any selector.</desc>
</argument>
</signature>
<desc>Selects elements which contain at least one element that matches the specified selector.</desc>
<longdesc>
<p>The expression <code>$('div:has(p)')</code> matches a <code><div></code> if a <code><p></code> exists anywhere among its descendants, not just as a direct child.</p>
</longdesc>
<note id="jquery-selector-extension-alt" type="additional" data-selector=":has()" data-alt="$("your-pure-css-selector").has(selector/DOMElement)"/>
<example>
<desc>Adds the class "test" to all divs that have a paragraph inside of them.</desc>
<code><![CDATA[$("div:has(p)").addClass("test");]]></code>
<html><![CDATA[<div><p>Hello in a paragraph</p></div>
<div>Hello again! (with no paragraph)</div>]]></html>
<css><![CDATA[
.test{ border: 3px inset red; }
]]></css>
</example>
<category slug="selectors/content-filter-selector"/>
<category slug="selectors/jquery-selector-extensions"/>
<category slug="version/1.1.4"/>
</entry>