Open hsuanweifu opened 7 years ago
https://github.com/twigkit/tempo/blob/master/examples/nested-conditional-templates.html On this example the second list does not show the expected result as it was shown on the first list. I believe that it was caused by
``` if (ready) { var foundTemplates = {}; for (var s = 0; s < children.length; s++) { if (children[s].getAttribute !== undefined) { if (utils.hasAttr(children[s], 'data-template-for') && children[s].getAttribute('data-template-for').length > 0 && this.nestedItem === children[s].getAttribute('data-template-for') && !foundTemplates[this.nestedItem]) { // Nested template this.createTemplate(children[s]); // Guards against recursion when child template has same name! foundTemplates[this.nestedItem] = true; } else if (utils.hasAttr(children[s], 'data-template') && !utils.isNested(children[s])) { // Normal template this.createTemplate(children[s]); } } }
What's the purpose of
// Guards against recursion when child template has same name! foundTemplates[this.nestedItem] = true;
By updating foundTemplates[this.nestedItem] to false the problem seems to be fixed.
https://github.com/twigkit/tempo/blob/master/examples/nested-conditional-templates.html On this example the second list does not show the expected result as it was shown on the first list. I believe that it was caused by