Skip to content

Commit 231a8d7

Browse files
committed
Fix with operator in no @DaTa mode
1 parent e2ba22e commit 231a8d7

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

lib/handlebars/base.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ function registerDefaultHelpers(instance) {
202202

203203
return fn(context, {
204204
data: data,
205-
blockParams: Utils.blockParams([context], [data.contextPath])
205+
blockParams: Utils.blockParams([context], [data && data.contextPath])
206206
});
207207
} else {
208208
return options.inverse(this);

spec/builtins.js

+6
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,12 @@ describe('builtin helpers', function() {
5151
var string = '{{#with person as |foo|}}{{foo.first}} {{last}}{{/with}}';
5252
shouldCompileTo(string, {person: {first: 'Alan', last: 'Johnson'}}, 'Alan Johnson');
5353
});
54+
it('works when data is disabled', function() {
55+
var template = CompilerContext.compile('{{#with person as |foo|}}{{foo.first}} {{last}}{{/with}}', {data: false});
56+
57+
var result = template({person: {first: 'Alan', last: 'Johnson'}});
58+
equals(result, 'Alan Johnson');
59+
});
5460
});
5561

5662
describe('#each', function() {

0 commit comments

Comments
 (0)