tildeio / htmlbars

A variant of Handlebars that emits DOM and allows you to write helpers that manipulate live DOM nodes
MIT License
1.6k stars 193 forks source link

Fix error for void elements #324

Closed chancancode closed 9 years ago

chancancode commented 9 years ago

While looking at #323, I also noticed that the error message was "wrong" (inaccurate), so I fixed it and added a test case for it. Previously, the "void elements cannot have end tags" only work if this happens in the root context.

This is the minimal diff to pass the test. Open to suggestions to make it more elegant.

Input:

<div>
  <input></input>
</div>

Before:

Closing tag `input` (on line 2) did not match last open tag `div` (on line 1).

After:

Invalid end tag `input` (on line 2) (void elements cannot have end tags).
rwjblue commented 9 years ago

LGTM

rwjblue commented 9 years ago

@mmun - r?

rwjblue commented 9 years ago

@mmun - Can you review when you have a minute?

mmun commented 9 years ago

Thanks!