mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-31 15:27:50 +00:00
Fix #547 - _.templateSettings is unchanged by custom settings.
This commit is contained in:
@@ -186,4 +186,10 @@ $(document).ready(function() {
|
||||
strictEqual(_.template(s)(data), 'x')
|
||||
});
|
||||
|
||||
test('#547 - _.templateSettings is unchanged by custom settings.', function() {
|
||||
ok(!_.templateSettings.variable);
|
||||
_.template('', {}, {variable: 'x'});
|
||||
ok(!_.templateSettings.variable);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
@@ -952,7 +952,7 @@
|
||||
// Underscore templating handles arbitrary delimiters, preserves whitespace,
|
||||
// and correctly escapes quotes within interpolated code.
|
||||
_.template = function(text, data, settings) {
|
||||
settings = _.extend(_.templateSettings, settings);
|
||||
settings = _.defaults(settings || {}, _.templateSettings);
|
||||
|
||||
// Compile the template source, taking care to escape characters that
|
||||
// cannot be included in a string literal and then unescape them in code
|
||||
|
||||
Reference in New Issue
Block a user