jQuery Templates Continued Again!

March 20th, 2008

Posted at 12:27pm by Stan

As I continue to get feedback on the jQuery Templates plugin I've ported from Ext I'm trying to implement the suggestions I've received. Subsequently, I've uploaded another round (or two) of changes. The changes I've made are:

  • Moved the $template object to $.template.instance, so that the object can be access from the jQuery object and extended easily - what was I thinking before??
  • Renamed the "re" property to "regx", and this is now an object containing several different regular expression options (jsp, jtemplates and ext for starters).
  • You can now change the standard regular expression by setting $.template.regx.standard = $.template.regx.myregexp;
  • Templates can utilize custom regular expressions on a per-template basis, ie. var t = $.template("<div>...</div>", { regx: 'ext' });
  • In addition to the methods that use domManip() I've updated html() and text() to handle receiving jQuery Templates as well.

I hope to add some kind of callback to the plugin as well, so that you can specify a method to be called after a template has been created or applied. I'm still thinking this through and will post more once I implement it.

Post Comment:


Enter the code you see in the image below.