-
Notifications
You must be signed in to change notification settings - Fork 0
/
pure3.html
46 lines (43 loc) · 1 KB
/
pure3.html
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
<html>
<head>
<title>PURE Unobtrusive Rendering Engine</title>
<script src="pure3.js"></script>
</head>
<body>
<!-- HTML template -->
It took:<span id="duration"></span>
<ul class="template">
<li class="people">
<span class="name"></span>
<ul>
<li class="team">
<a class="name"></a>
</li>
</ul>
</li>
</ul>
<script>
function callback(data){
var start = new Date().getTime();
//declaration of the actions PURE has to do
var directive = {
'li.people':{
'person<-people':{
'span.name':'person.name',
'li.team':{
'teamMember<-person.team':{
'a.name':'teamMember.name',
'a.name@href+':'teamMember.id'
}
}
}
}
};
// note the use of render instead of autoRender
$p('ul.template').noClone().render(data, directive);
document.getElementById('duration').innerHTML = (new Date().getTime() - start) + 'ms for ' + data.people.length + ' records';
}
</script>
<script src="data.js"></script>
</body>
</html>