wp/wp-includes/js/wp-util.js
changeset 21 48c4eec2b7e6
parent 18 be944660c56a
equal deleted inserted replaced
20:7b1b88e27a20 21:48c4eec2b7e6
    34 				escape:      /\{\{([^\}]+?)\}\}(?!\})/g,
    34 				escape:      /\{\{([^\}]+?)\}\}(?!\})/g,
    35 				variable:    'data'
    35 				variable:    'data'
    36 			};
    36 			};
    37 
    37 
    38 		return function ( data ) {
    38 		return function ( data ) {
       
    39 			if ( ! document.getElementById( 'tmpl-' + id ) ) {
       
    40 				throw new Error( 'Template not found: ' + '#tmpl-' + id );
       
    41 			}
    39 			compiled = compiled || _.template( $( '#tmpl-' + id ).html(),  options );
    42 			compiled = compiled || _.template( $( '#tmpl-' + id ).html(),  options );
    40 			return compiled( data );
    43 			return compiled( data );
    41 		};
    44 		};
    42 	});
    45 	});
    43 
    46