fix bug that happened when a template contained another template as its first child

This commit is contained in:
Geoff Schmidt
2012-01-18 20:10:25 -08:00
parent a5d650e7ce
commit 618d6f71bc
2 changed files with 7 additions and 2 deletions

View File

@@ -79,7 +79,8 @@ Sky._def_template = function (name, raw_func) {
if (replacement) {
elt.replaceChild(replacement, child);
delete Sky._pending_partials[child.id];
child = elt.childNodes[i];
i--;
continue;
}
traverse(child);
}

View File

@@ -1,6 +1,10 @@
test("template assembly", function () {
// Test for a bug that made it to production -- after a replacement,
// also check the newly replaced node for replacements
var x = Template.test_assembly_3();
var x = Template.test_assembly_0();
assert.lengthIs(x.childNodes, 1);
});
// Test that if a template throws an error, then pending_partials is
// cleaned up properly (that template rendering doesn't break..)