-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.html
32 lines (27 loc) · 868 Bytes
/
test.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<!DOCTYPE html>
<html>
<head>
<title>Test example | cristiandouce-render</title>
<script type="text/javascript" src="build/build.js"></script>
</head>
<body>
<h3>Compiled HTML DOM</h3>
<div id="content"></div>
<h3>Compiled HTML text</h3>
<div id="text"></div>
<script type="text/javascript">
var render = require('render');
function template(locals) {
return '<a href="' + locals.link + '" target="_blank">\n'
+ '<span>' + locals.title + '</span>\n'
+ '</a>\n';
}
render.set('link', 'http://github.com/cristiandouce/render');
var locals = { title: 'cristiandouce/render' };
var compiled = render.dom(template, locals);
var html = render(template, locals);
document.querySelector('#content').appendChild(compiled);
document.querySelector('#text').innerText = html;
</script>
</body>
</html>