bminer / node-blade

Blade - HTML Template Compiler, inspired by Jade & Haml
Other
320 stars 28 forks source link

Nested foreach doesn't work #192

Closed alvaro-cuesta closed 10 years ago

alvaro-cuesta commented 10 years ago

Minimal code:

ol
  foreach boxes as box
    li
      ol
        foreach box as element
          li= element

render(view, boxes: [['One', 'Two'], ['Three', 'Four'])

Results in: TypeError: Cannot read property '_id' of undefined

bminer commented 10 years ago

I cannot replicate this bug. Instead, I get the following HTML output, as expected:

<ol><li><ol><li>one</li><li>two</li></ol></li><li><ol><li>three</li><li>four</li></ol></li></ol>
bminer commented 10 years ago

Try

render(view, boxes: [['One', 'Two'], ['Three', 'Four']])

Not

render(view, boxes: [['One', 'Two'], ['Three', 'Four'])

Notice the missing ].