Skip to content

Instantly share code, notes, and snippets.

@pure
Created April 4, 2011 22:30
Show Gist options
  • Save pure/902610 to your computer and use it in GitHub Desktop.
Save pure/902610 to your computer and use it in GitHub Desktop.
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title></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>
<table>
<thead>
<tr><th></th></tr>
</thead>
<tbody>
<tr><td></td></tr>
</tbody>
</table>
<script>
var headerDir = {
'th':'caption.name',
},
dataDir = {
'tr':{
'listItem<-list':{
'td':'listItem.name'
}
}
},
data = {caption:{name:'Name'},list:[{name:'item 1'}, {name:'item 2'}]},
compiledHeader = $('thead').compile(headerDir),
compiledData = $('tbody').compile(dataDir);
$('thead').render(data, compiledHeader);
$('tbody').render(data, compiledData);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment