forked from bitovi/jquerypp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstyles.html
More file actions
69 lines (60 loc) · 1.41 KB
/
styles.html
File metadata and controls
69 lines (60 loc) · 1.41 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<title>CurStyles Performance Test/Demo</title>
<style type='text/css'>
body {font-family: verdana}
#content {height: 100px; width: 300px;
margin: 20px;
padding: 10px;
border: solid 1px black;
cursor: pointer;
}
</style>
</head>
<body>
<h1>CurStyles Performance</h1>
<p>This demo shows how $.styles out-performs $.curCSS</p>
<div id="demo-html">
<div id='content'>
Click To Run
</div>
</div>
<script type='text/javascript'
src='../../../steal/steal.js'></script>
<script type='text/javascript' id="demo-source">
steal('jquerypp/dom/styles').then(function(){
$.fn.fastHeight = function(){
var sum = this[0] && this[0].offsetHeight;
$.each(this.styles(
"borderTopWidth",
"borderBottomWidth",
"paddingTop",
"paddingBottom"), function(name, val){
sum -= parseInt(val) || 0;
});
return sum;
}
var test = function(func){
var start = new Date(),
content = $("#content");
for(var i =0; i < 2000; i++){
content[func]()
}
return ( new Date() - start );
};
$("#content").click(function(){
var height = test("height"),
fastheight = test("fastHeight");
$("#content").html("jQuery's height: <b>"+
height+
"</b>ms<br/>fastHeight: <b>"+
fastheight+
"</b>ms"
)
});
});
</script>
</body>
</html>