Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/template.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ var Hogan = {};

// check to see that if we've instantiated this partial before
var template = partials[partial.name];
if (partial.instance && partial.base == template) {
if (partial.instance && !partial.subs && partial.base == template) {
return partial.instance;
}

Expand Down
7 changes: 7 additions & 0 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1035,6 +1035,13 @@ test("Lambdas work in multi-level inheritance", function() {
is(child, 'changed c - changed p - changed o - changed g', 'should be changed child value');
});

test("Sub content from first invocation must not appear in the second", function() {
const main = Hogan.compile('{{<parent}}{{$sub}}D{{/sub}}{{/parent}}{{>parent}}');
const parent = Hogan.compile('{{>child}}');
const child = Hogan.compile('{{$sub}}{{/sub}}');
is(main.render({}, { 'parent': parent, 'child': child }), 'D');
});

/* Safety tests */

test("Updates object state", function() {
Expand Down