JSFiddle - React, Tailwind, and code Playground

by TheSneak

HTML

<script src="https://raw.github.com/jquery/jquery-tmpl/master/jquery.tmpl.js"></script>

<div id="placeholder"></div>

<script id="tmpl" type="text/x-jquery-tmpl">
    <input type="text" {{if brother && brother.likesBlue}}value="this guy likes blue"{{/if}} />
</script>

<script id="workaround" type="text/x-jquery-tmpl">
    <input type="text" {{if $data.hasOwnProperty("brother") && brother.likesBlue}}value="this guy likes blue"{{/if}} />
</script>

CSS

div{
    background-color: red;
}

JavaScript

var stuff = {
    xbrother: { likesBlue: true }
};

try {
    $("#tmpl").tmpl(stuff).appendTo("#placeholder");
} catch (ex) {
    $("#placeholder").text("Error on line " + ex.lineNumber + ": " + ex.message);
}

try {
    $("#workaround").tmpl({}).appendTo("#placeholder");
} catch (ex) {
    $("#placeholder").text("Error on line " + ex.lineNumber + ": " + ex.message);
}