4 ms·
I'm disappointed that template syntax uses own {{if}} tags: {{if cond}}<li>...</li>{{/if}} TAL and Genshi have IMHO much nicer solution for that: <li
by pornel 16y ago
I'm disappointed that template syntax uses own {{if}} tags:
{{if cond}}<li>...</li>{{/if}}
TAL and Genshi have IMHO much nicer solution for that:
<li py:if="cond">...</li>
Use of attributes on existing elements also ensures that you can't create ill-formed structures like {{if}}<li>{{/if}}</li>.
- dstik 16y agoUnderscore.js (http://documentcloud.github.com/underscore/ http://documentcloud.github.com/underscore/) provides great Templating support and the ability to customize your templates through the use of _.templateSettings. This would allow you to use <% %>, [% %], or pretty much any symbol combination you prefer.
- saurabh 16y agoCheck out jstal http://code.google.com/p/jstal/ http://code.google.com/p/jstal/
- jeresig 16y agoWe opted not to use this particular technique for two reasons: 1) It's not nearly as versatile. You can use the if statements on elements, attributes, text - anything you wish - there is no restriction on its contents or location. 2) In order to actually use something like that we'd have to serialize the DOM tree first, traverse it, and then manipulate the nodes into the proper shape. This is slow slow slow and absolutely must be avoided at any cost.
- detst 16y agoA little off topic but I expect this to go well with jQuery Mobile. Can we expect any updates there? Been a bit disappointed by the relative quiet since the announcement (not that you owe me anything). Also, is there any publicly available code to check out? Thanks!
- jeresig 16y agoOnly quiet because we're working so hard. We're releasing the alpha on October 16th (at the jQuery conference in Boston) so we're a bit frantic at the moment. Either way we're hoping to get a blog post up this week.
- detst 16y agoThanks, I'm looking forward to it and trying to be patient.
- tchvil 16y agoI'm surprised you say it is slow, the first version of pure.js was built with "pure:..." attributes, and it was as fast as the current version.
- pornel 16y agoThanks for reply. I see reason 1. as a downside — it allows very messy Smarty-like markup that can generate ill-formed HTML. 2. I think there's little difference whether you serialize first or later. Are all those new fancy DOM traversal, XPath and XSLT APIs really not faster than parsing and joining of strings?
- jeresig 16y ago"Are all those new fancy DOM traversal, XPath and XSLT APIs really not faster than parsing and joining of strings?" It cannot be understated how much slower touching the DOM is compared to doing string manipulation. Any DOM touching - but generating DOM nodes and traversing them is radically slow. If you want to support Internet Explorer it's not even an option, as far as performance goes.
- konad 16y agoInner Platform, new loop constructs next