Skip to content

Instantly share code, notes, and snippets.

@pure
Created December 6, 2009 10:32
Show Gist options
  • Save pure/250152 to your computer and use it in GitHub Desktop.
Save pure/250152 to your computer and use it in GitHub Desktop.
Auto-render Iteration
<html>
<head>
<title>PURE Unobtrusive Rendering Engine</title>
<script src="../libs/jquery.js"></script>
<script src="../libs/pure.js"></script>
</head>
<body>
<!-- HTML template -->
<ul>
<!-- Explanation of the classes of the LI:
* "animals" points to an array and will trigger an iteration
* "name" points to the property within the array and will set
the node value of the LI
-->
<li class="animals name"></li>
</ul>
<script>
// animals is an array and will trigger an iteration
var data = {
animals:[
{name:'bird'},
{name:'cat'},
{name:'dog'},
{name:'mouse'}
]
};
$('ul').autoRender(data);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment