CoreFiles by mySites.guru
template.js29 lines, 798 bytes, from wordpress-3.6-beta3.zip
Raw History Compare with 3.6-beta2
md5
7f4e58d529d88a7a80f90778c7c9f874
sha1
a4b666052cad95abaab5524d1b14a36c3c2e0211
sha256
03eb39b28e05c7fefaced53ca57338d9e1a74765cab6610ace154807c0939575
window.wp = window.wp || {};

(function ($) {
	var template;
	/**
	 * wp.template( id )
	 *
	 * Fetches a template by id.
	 *
	 * @param  {string} id   A string that corresponds to a DOM element with an id prefixed with "tmpl-".
	 *                       For example, "attachment" maps to "tmpl-attachment".
	 * @return {function}    A function that lazily-compiles the template requested.
	 */
	template = wp.template = _.memoize(function ( id ) {
		var compiled,
			options = {
				evaluate:    /<#([\s\S]+?)#>/g,
				interpolate: /\{\{\{([\s\S]+?)\}\}\}/g,
				escape:      /\{\{([^\}]+?)\}\}(?!\})/g,
				variable:    'data'
			};

		return function ( data ) {
			compiled = compiled || _.template( $( '#tmpl-' + id ).html(), null, options );
			return compiled( data );
		};
	});

}(jQuery));

The same content is in 3 releases, WordPress 3.6-beta1 to 3.6-beta3. See them all, or every version of this file.