Once function has been compiled, does it need document any longer?

11 views
Skip to first unread message

Jeff Barczewski

unread,
Jan 24, 2012, 7:13:09 PM1/24/12
to Pure-Unobtrusive...@googlegroups.com
Mic or all,

Once you compile a function, does it need document any longer?

For example:

var fn = pure(docElement).compile(docDirectives);


From here on out, does pure still use its reference to document or is it compiled to using all strings by this point?

So when I call 

var output = fn(jsonData);  // will document still be used or was it only used during compile?


The reason this is important is because I am looking at how I can use this with node.js using precompiled temlplates.

Thanks for your help!

Jeff

Mic (BeeBole)

unread,
Jan 25, 2012, 4:12:52 PM1/25/12
to JavaScript Templates Engine PURE
pure.js was designed for the browser and the DOM.
The browser is a decentralized process while the server has it
centralized.
The time pure.js takes to compile and render is irrelevant compared to
other running times, mainly the latency.

On the server you try to shave every milliseconds and bytes for each
in/out requests.
Even if it is technically possible, I'm not sure pure.js, JSDOM,
jQuery and others are right for server side.

Surprisingly, the v1(checkout the branch version1) with all its
clunkiness was designed to generate only HTML strings, no DOM at
rendering.
It was even generating the js source file of the compiled template to
be used as a normal js file.

Jeff Barczewski

unread,
Jan 25, 2012, 4:44:30 PM1/25/12
to Pure-Unobtrusive...@googlegroups.com
Thanks Mic. 

I will check it out. 

I think if something like pure can work client side and generate a precompiled function to be used server side, then it is really the killer solution. You can use the same code in both places. 

I'll take a look at v1.

All the best,

Jeff
Reply all
Reply to author
Forward
0 new messages