git-svn-id: https://develop.svn.wordpress.org/trunk@24366 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
dc997217bb
commit
7da0dbcbb4
@ -93,25 +93,9 @@ window.wp = window.wp || {};
|
|||||||
* media.template( id )
|
* media.template( id )
|
||||||
*
|
*
|
||||||
* Fetches a template by id.
|
* Fetches a template by id.
|
||||||
*
|
* See wp.template() in `wp-includes/js/wp-backbone.js`.
|
||||||
* @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: _.memoize( function( id ) {
|
template: wp.template,
|
||||||
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 );
|
|
||||||
};
|
|
||||||
}),
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* media.post( [action], [data] )
|
* media.post( [action], [data] )
|
||||||
|
Loading…
x
Reference in New Issue
Block a user