forked from jquery/api.jquery.com
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathall-selector.xml
71 lines (71 loc) · 1.87 KB
/
all-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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<?xml version="1.0"?>
<entry type="selector" name="all" return="">
<title>All Selector ("*")</title>
<sample>*</sample>
<signature>
<added>1.0</added>
</signature>
<desc>Selects all elements.</desc>
<longdesc>
<p>Caution: The all, or universal, selector is extremely slow, except when used by itself.</p>
</longdesc>
<example>
<desc>Find every element (including head, body, etc) in the document. Note that if your browser has an extension/add-on enabled that inserts a <code><script></code> or <code><link></code> element into the DOM, that element will be counted as well.</desc>
<code><![CDATA[
var elementCount = $( "*" ).css( "border", "3px solid red" ).length;
$( "body" ).prepend( "<h3>" + elementCount + " elements found</h3>" );
]]></code>
<html><![CDATA[
<div>DIV</div>
<span>SPAN</span>
<p>P <button>Button</button></p>
]]></html>
<css><![CDATA[
h3 {
margin: 0;
}
div, span, p {
width: 80px;
height: 40px;
float: left;
padding: 10px;
margin: 10px;
background-color: #EEEEEE;
}
]]></css>
</example>
<example>
<desc>Find all elements within document.body so elements like head, script, etc. are excluded.</desc>
<code><![CDATA[
var elementCount = $( "#test" ).find( "*" ).css( "border", "3px solid red" ).length;
$( "body" ).prepend( "<h3>" + elementCount + " elements found</h3>" );
]]></code>
<html><![CDATA[
<div id="test">
<div>DIV</div>
<span>SPAN</span>
<p>P <button>Button</button></p>
</div>
]]></html>
<css><![CDATA[
h3 {
margin: 0;
}
div, span, p {
width: 80px;
height: 40px;
float: left;
padding: 10px;
margin: 10px;
background-color: #EEEEEE;
}
#test {
width: auto;
height: auto;
background-color: transparent;
}
]]></css>
</example>
<category slug="selectors/basic-css-selectors"/>
<category slug="version/1.0"/>
</entry>