tildeio / htmlbars

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

The `chars` a TextNode inside a BlockStatement is a lie. #454

Open ghost opened 8 years ago

ghost commented 8 years ago

Example:

{{#foo}}

{{/foo}}

Will report a TextNode inside the BlockStatement with chars: '\n' while this should be chars: '\n\n'. I would also accept the start location of the TextNode to be on the new line.

rwjblue commented 8 years ago

It is actually "correct". A block statement or mustache statement will "eat" a newline if it follows directly after the mustaches.

mmun commented 8 years ago

This is a default feature of the Handlebars parser. We can disable it but it is a breaking change. See https://github.com/wycats/handlebars.js/issues/1072 and https://github.com/wycats/handlebars.js/commit/ea3a5a1.