Last active
August 29, 2015 14:15
-
-
Save rmcauley/3ae35bf6bf0edcadae1d to your computer and use it in GitHub Desktop.
Works Of A Man Gone Mad
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> | |
<!-- | |
<h1 class="hello" bind="h1">Parse me!</h1> | |
{{#each line }} | |
<div class="song" class="{{ title }}" bind="title"> | |
` {{ title }} | |
</div> | |
{{/each}} | |
{{#with line[0]}} | |
<div style="color: red;">{{ title }}</div>' | |
{{/with}} | |
{{#if true }} | |
<span>blurgh</span> | |
{{/if}} | |
{{#if false }} | |
<div>This is a positive.</div> | |
{{#else}} | |
<div>This is a negative!</div> | |
{{/if}}\n | |
--> | |
<script> | |
(function(){var d=document;d.cE=d.createElement;Element.prototype.sA=Element.prototype.setAttribute;Element.prototype.aC=Element.prototype.appendChild;window.RWTemplates={ main:function(ctx){"use strict";ctx=ctx||{};if(!ctx.$template)ctx.$template={};var rctx=ctx;if(!ctx.$template.root)ctx.$template.root=d.createDocumentFragment();var tr=ctx.$template.root;tr.aC=tr.appendChild;var v1=d.cE('h1');tr.aC(v1);v1.sA('class',"hello");ctx.$template.h1=v1;v1.textContent="Parse me!";var v2=function(ctx){var v3=d.cE('div');tr.aC(v3);v3.sA('class',"song");v3.sA('class',ctx.title);ctx.$template.title=v3;v3.textContent=ctx.title;};for(var i= 0;i<ctx.line.length;i++){if(!ctx.line[i].$template)ctx.line[i].$template={};v2(ctx.line[i]);}var v4=function(ctx){var v5=d.cE('div');tr.aC(v5);v5.sA('style',"color: red;");v5.textContent=ctx.title;};v4(ctx.line[0]);var v6=function(ctx){var v7=d.cE('span');tr.aC(v7);v7.textContent="blurgh";};if(true)v6(ctx);var v8=function(ctx){var v9=d.cE('div');tr.aC(v9);v9.textContent="This is a positive.";};if(ctx.false)v8(ctx);var v10=function(ctx){var v11=d.cE('div');tr.aC(v11);v11.textContent="This is a negative!";};if(!(ctx.false))v10(ctx);return ctx;}};})(); | |
var thbbt = { "line": [ { "title": "Hello" }, { "title": "World" }, { "title": "How" }, { "title": "Are" }, { "title": "You?" } ] }; | |
window.addEventListener('load', function() { | |
document.getElementById("one").appendChild(RWTemplates.main(thbbt).$template.root); | |
}); | |
</script> | |
<body> | |
<div id="one"></div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment