Hi, I made a simple port of Ext.Template [1] / Ext.MasterTemplate [2] to be used with jQuery, removing Ext dependencies and so. The result is tiny - 2,4KB packed, and given that it can make other codes smaller, I think it is worth. Here's the code (feedback appreciated, I'm not a javascript master! ;):
http://dev.tipos.org/browser/javascript/jquery/template/jquery.template.js?format=txt I still have three global functions while I'm looking for alternatives in the jQuery world. I'm looking for something that helps extending classes / overriding class members in jQuery or any jQuery plugin/utility. Something like the extend() function in YUI or Ext. Is there any? thanks, rodrigo [1] http://extjs.com/deploy/ext/docs/output/Ext.Template.html [2] http://extjs.com/deploy/ext/docs/output/Ext.MasterTemplate.html ------------------------------- Usage (based on Ext.MasterTemplate docs): var t = new $.MasterTemplate( '<select name="{name}">', '<tpl name="options"><option value="{value}">{text}</option></tpl>', '</select>' ); t.add('options', {value: 'foo', text: 'bar'}); // or you can add multiple child elements in one shot t.fill('options', [ {value: 'foo', text: 'bar'}, {value: 'foo2', text: 'bar2'}, {value: 'foo3', text: 'bar3'} ]); // then append applying the master template values $(document.body).append(t.apply({name: 'my-select'}));