examples/jquery-tmpl/assets/scripts/jquery.tmpl.js
function( tmpl, data, options, parentItem ) {
			var ret, topLevel = !parentItem;
			if ( topLevel ) {
				// This is a top-level tmpl call (not from a nested template using {{tmpl}})
				parentItem = topTmplItem;
				tmpl = jQuery.template[tmpl] || jQuery.template( null, tmpl );
				wrappedItems = {}; // Any wrapped items will be rebuilt, since this is top level
			} else if ( !tmpl ) {
				// The template item is already associated with DOM - this is a refresh.
				// Re-evaluate rendered template for the parentItem
				tmpl = parentItem.tmpl;
				newTmplItems[parentItem.key] = parentItem;
				parentItem.nodes = [];
				if ( parentItem.wrapped ) {
					updateWrapped( parentItem, parentItem.wrapped );
				}
				// Rebuild, without creating a new template item
				return jQuery( build( parentItem, null, parentItem.tmpl( jQuery, parentItem ) ));
			}
			if ( !tmpl ) {
				return []; // Could throw...
			}
			if ( typeof data === "function" ) {
				data = data.call( parentItem || {} );
			}
			if ( options && options.wrapped ) {
				updateWrapped( options, options.wrapped );
			}
			ret = jQuery.isArray( data ) ? 
				jQuery.map( data, function( dataItem ) {
					return dataItem ? newTmplItem( options, parentItem, tmpl, dataItem ) : null;
				}) :
				[ newTmplItem( options, parentItem, tmpl, data ) ];
			return topLevel ? jQuery( build( parentItem, null, ret ) ) : ret;
		}
function( tmpl, data, options, parentItem ) {
			var ret, topLevel = !parentItem;
			if ( topLevel ) {
				// This is a top-level tmpl call (not from a nested template using {{tmpl}})
				parentItem = topTmplItem;
				tmpl = jQuery.template[tmpl] || jQuery.template( null, tmpl );
				wrappedItems = {}; // Any wrapped items will be rebuilt, since this is top level
			} else if ( !tmpl ) {
				// The template item is already associated with DOM - this is a refresh.
				// Re-evaluate rendered template for the parentItem
				tmpl = parentItem.tmpl;
				newTmplItems[parentItem.key] = parentItem;
				parentItem.nodes = [];
				if ( parentItem.wrapped ) {
					updateWrapped( parentItem, parentItem.wrapped );
				}
				// Rebuild, without creating a new template item
				return jQuery( build( parentItem, null, parentItem.tmpl( jQuery, parentItem ) ));
			}
			if ( !tmpl ) {
				return []; // Could throw...
			}
			if ( typeof data === "function" ) {
				data = data.call( parentItem || {} );
			}
			if ( options && options.wrapped ) {
				updateWrapped( options, options.wrapped );
			}
			ret = jQuery.isArray( data ) ? 
				jQuery.map( data, function( dataItem ) {
					return dataItem ? newTmplItem( options, parentItem, tmpl, dataItem ) : null;
				}) :
				[ newTmplItem( options, parentItem, tmpl, data ) ];
			return topLevel ? jQuery( build( parentItem, null, ret ) ) : ret;
		}
function ( tmpl , data , options , parentItem ) { var ret , topLevel = ! parentItem ; if ( topLevel ) { // This is a top-level tmpl call (not from a nested template using {{tmpl}}) parentItem = topTmplItem ; tmpl = jQuery . template [ tmpl ] || jQuery . template ( null , tmpl ) ; wrappedItems = { } ; // Any wrapped items will be rebuilt, since this is top level } else if ( ! tmpl ) { // The template item is already associated with DOM - this is a refresh. // Re-evaluate rendered template for the parentItem tmpl = parentItem . tmpl ; newTmplItems [ parentItem . key ] = parentItem ; parentItem . nodes = [ ] ; if ( parentItem . wrapped ) { updateWrapped ( parentItem , parentItem . wrapped ) ; } // Rebuild, without creating a new template item return jQuery ( build ( parentItem , null , parentItem . tmpl ( jQuery , parentItem ) ) ) ; } if ( ! tmpl ) { return [ ] ; // Could throw... } if ( typeof data === "function" ) { data = data . call ( parentItem || { } ) ; } if ( options && options . wrapped ) { updateWrapped ( options , options . wrapped ) ; } ret = jQuery . isArray ( data ) ? jQuery . map ( data , function ( dataItem ) { return dataItem ? newTmplItem ( options , parentItem , tmpl , dataItem ) : null ; } ) : [ newTmplItem ( options , parentItem , tmpl , data ) ] ; return topLevel ? jQuery ( build ( parentItem , null , ret ) ) : ret ; }
Return wrapped set of template items, obtained by rendering template against data.
Return wrapped set of template items obtained by rendering template against data .