Allow _.template functions to be called with no arguments.

This change simply allows templates to be called with no arguments, for a behaviour equivalent to being called with an empty object, {}.
This commit is contained in:
Nick Stenning
2010-07-14 11:09:05 +01:00
parent 868c5c8d85
commit e81a2ec516
2 changed files with 5 additions and 1 deletions

View File

@@ -59,6 +59,10 @@ $(document).ready(function() {
result = fancyTemplate({people : {moe : "Moe", larry : "Larry", curly : "Curly"}});
equals(result, "<ul><li>Moe</li><li>Larry</li><li>Curly</li></ul>", 'can run arbitrary javascript in templates');
var noInterpolateTemplate = _.template("<div><p>Just some text. Hey, I know this is silly but it aids consistency.</p></div>");
result = noInterpolateTemplate();
equals(result, "<div><p>Just some text. Hey, I know this is silly but it aids consistency.</p></div>");
var quoteTemplate = _.template("It's its, not it's");
equals(quoteTemplate({}), "It's its, not it's");