Message from JavaScript discussions

November 2017

— IMO having html anywhere in a js document is a big no no, it's an old principle called Unobtrusive JS

Message permanent page

— 

I tend to lean towards the old ways like that because they are not convoluted like today's standards and frameworks

— 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

Message permanent page

— 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);

Message permanent page

— 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

Message permanent page