Updating compiled template without regenerating DOM

11 views
Skip to first unread message

Steven

unread,
Oct 17, 2010, 8:20:18 PM10/17/10
to YAJET
YAJET Developer(s)-

Thanks for making your template engine. I've found it to be quite
useful and verbose.

I have a unique problem that I am trying to solve, and trying to find
a JavaScript template engine that might be able to solve it. I've
tried jQuery Templates, plus a few other lame engines, and finally I
found YAJET. However none of these engines can do what I need, but
YAJET may possibly be hackable to the point where I can force it to do
what I need. That's why I am posting here, hoping to get some advice
as to how to go about this.

Problem:
I am working on a website that uses complex template API's that
control styling of all elements on a page (based on jQuery-UI). The
YAJET-HTML templates are sent to the browser through JSON, and then
dynamically created using data provided by the server. I need to be
able to update some variables inside these templates without removing
them from the DOM, because doing so removes all the CSS attributes
created by my styling API. The obvious approach would be to extend the
style API to re-add the styles after each update, but this is too
intensive for the browser to do, especially when I may only be
updating a single variable in a giant template. Additionally it kicks
the user out of any current activity (filling out a form, scrolling,
etc).

The best solution I can imagine is to use a template API that allows
me to update a pre-compiled template, but only update the specific
values that have changed. All while still maintaining styling and
other attributes added after the original compilation. I have yet to
find a system that can (easily) allow me to do this. Previously I was
wrapping all variables in a unique ID, and then updating each variable
based on that ID, but this approach has obvious limitations (and
serious efficiency questions, both for processing and in creating
complex templates).

I'm sure you can see the unique difficulty in this problem. If you
have any advice as to how this can be accomplished, I would appreciate
it.

Thanks!

----
Steven Bower
TurnWheel Designs
Reply all
Reply to author
Forward
0 new messages