Message from JavaScript discussions
November 2017
— Yes, that's the core principle behind it
So the template engine works as quickly as possible to convert a tagString to real nodes, then works on those
— I think it does some of what you want... with a custom injector
— This one doesn't bind, it's one-way
— Heres an injector that comes with it, you can add custom ones
—
// Wraps the entire element in an `<a>` tag and sets it's `href` attribute.
"data-link-wrap": function (input, target) {
var a = document.createElement("a");
a.setAttribute("href", input);
a.insertAdjacentElement("afterbegin", target.cloneNode(true));
target.parentNode.replaceChild(a, target);
— That definitely looks like it does some structure related things like you said
— Works on:
<div data-link-wrap="tag">Hi</div>
— To turn it into
<a href="url"><div>Hi</div></a>
— Updating dynamic data is possible because it can patch templates as well using the removeAttrs: false
config setting
— My equivalent (because I hate mustache and all other template engines that use that syntax)
template:<a data-href="link" data-content-text="name"></a>
JSON:
{
link: "someLink",
name: "someName"
}
— There are also no visual side effects to load failure, so you can put in placeholders