Permalink
Browse files

add comparison 2/3

  • Loading branch information...
1 parent b401c22 commit 9bff989339f303bd9f9bc814bea9cb4d6a27446a @pure committed Dec 17, 2011
Showing with 49 additions and 0 deletions.
  1. +49 −0 v3_preview/pure2.html
View
@@ -0,0 +1,49 @@
+<html>
+<head>
+ <title>PURE Unobtrusive Rendering Engine</title>
+ <script src="../libs/pure.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(json){
+ 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'
+ }
+ }
+ }
+ }
+ };
+
+/* var compiled = $p( 'ul.template' ).compile( directive );
+ console.log( compiled( json ).outerHTML );*/
+
+ $p('ul.template').render( json, directive );
+ document.getElementById('duration').innerHTML = ( new Date().getTime() - start ) + 'ms for ' + json.people.length + ' records';
+
+ }
+</script>
+<script src="data.js"></script>
+</body>
+</html>

0 comments on commit 9bff989

Please sign in to comment.