Created
December 6, 2009 10:32
-
-
Save pure/250152 to your computer and use it in GitHub Desktop.
Auto-render Iteration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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