Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 815728cb85
Fetching contributors…

Cannot retrieve contributors at this time

45 lines (39 sloc) 0.942 kb
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<title>pure3</title>
<script src="pure3.js"></script>
</head>
<body>
<div style="display:none">
<div class="template">
<span></span>
<a href="http://"></a>
<input type="button" />
</div>
</div>
<div id="result"></div>
<script>
var data = {
who:'wrrrld',
id:'345',
href:'beebole.com',
site:'hello'
},
directive = {
'a':'site',
'a@href+':'href',
'a@id':'id',
'span':function(){
return this.who;
},
'span@id':'id',
'input@value':'anyText'
},
template = $p('div.template')[0].cloneNode(true), //!templates are not copied by default anymore
rfn = $p(template).compile(directive); //!the compiled function returns a DOM node, not a string anymore
document.getElementById('result').appendChild( rfn(data) );
</script>
</body>
</html>
Jump to Line
Something went wrong with that request. Please try again.