Created
October 14, 2010 20:40
-
-
Save pure/627007 to your computer and use it in GitHub Desktop.
This file contains hidden or 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="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"> | |
</script> | |
<script src="http://github.com/pure/pure/raw/master/libs/pure.js"> | |
</script> | |
</head> | |
<body> | |
<!-- HTML template --> | |
<div class="template"> | |
Hello <a></a> | |
</div> | |
<!-- result place --> | |
<div class="result"></div> | |
<script> | |
var jsonData = { | |
who:'BeeBole!', | |
site:'http://beebole.com' | |
}; | |
//select the template | |
$('div.template') | |
//map the HTML with the JSON data | |
.directives({ 'a':'who', 'a@href':'site' }) | |
//generate the new HTML | |
.render(jsonData) | |
//place the result in the DOM, using any jQuery command | |
.appendTo('div.result'); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment