mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-03 00:27:50 +00:00
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:
@@ -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");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user