DOMly
DOMly copied to clipboard
Gratuitous string concatenation occurs when escaped curly braces are present
The output is less than ideal when \{
and \}
are present -- there is additional string concatenation going on in the compiled function that is pretty ugly:
Template:
\{\{Outer with data\}\} {{data.name}}
<code>
\{\{Nested\}\}
</code>
<code>
\{\{Nested with data\}\} {{data.name}}
</code>
Output:
(function anonymous(data_0) {
var frag = document.createDocumentFragment();
var data = data_0;
var el0 = document.createTextNode("{"+"{"+"Outer with data"+"}"+"}"+" "+data_0["name"]+"\n\n");
frag.appendChild(el0);
var el1 = document.createElement("code");
el1.textContent = "\n "+"{"+"{"+"Nested"+"}"+"}"+"\n";
frag.appendChild(el1);
var el2 = document.createTextNode("\n\n");
frag.appendChild(el2);
var el3 = document.createElement("code");
el3.textContent = "\n "+"{"+"{"+"Nested with data"+"}"+"}"+" "+data_0["name"]+"\n";
frag.appendChild(el3);
return frag;
})
The parser could be modified to concatenate the braces into an existing content block instead of creating a new one, or DOMly could be fixed to combine content blocks into a single string instead of concatenating multiple strings.
This is due to the fixes for #7. @cif