-
Notifications
You must be signed in to change notification settings - Fork 260
Expand file tree
/
Copy pathall-selector.xml
More file actions
54 lines (52 loc) · 1.63 KB
/
all-selector.xml
File metadata and controls
54 lines (52 loc) · 1.63 KB
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
<entry type='selector' name="all" return="" >
<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>Finds every element (including head, body, etc) in the document.</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>A common way to select all elements is to find within document.body so elements like head, script, etc are left out.</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>
</entry>