forked from chuanxshi/javascript-patterns
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuniversal-selector.html
More file actions
34 lines (25 loc) · 514 Bytes
/
Copy pathuniversal-selector.html
File metadata and controls
34 lines (25 loc) · 514 Bytes
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
<!doctype html>
<html lang="en">
<head>
<title>JavaScript Patterns</title>
<meta charset="utf-8">
</head>
<body>
<script>
/* Title: Universal Selector
* Description: better use of universal selector
*/
// antipattern 1
$('.buttons > *')
// preferred 1
$('.buttons').children()
// antipattern 2
$('.gender :radio')
$('.gender *:radio')
// preferred 2
$('.gender input:radio')
// References
// http://paulirish.com/2009/perf/
</script>
</body>
</html>