Message from JavaScript discussions
November 2017
— Since it overwrites without append: true
But anyways, that's just what I use for my own projects, since I like that data
attribute thing and it's W3C valid still
— It's actually a port of jQuery-template
—
DialogBox.prototype.render = function () {
if (this.node === null) {
ct.loadTemplate("#dialogTemplate", "#dialogContainer", {
append: true,
data: this.data,
removeAttrs: false,
thisArg: this,
success: this.onRenderSuccess
});
} else {
ct.loadTemplate(this.node, "#dialogContainer", {
data: this.data,
removeAttrs: false,
thisArg: this,
success: this.onRenderSuccess
});
}
};
— I used it to make a dialog box library, well the start of one
— The else
is where the box is already loaded, but the data changed, so it is patching itself
— Because you can load templates from live dom nodes, I just had it load itself as a template and replace itself
— removeAttrs: false
is there so the attributes stay, allowing that patch to work
— So really... it is far superior to mustache in terms of functionality
— You can just continually patch the same nodes without worrying about the template syntax going away
— Yes, too many haha
— I like combining Flux with template engines