Compile failing when partial is an instance of Handlebars.SafeString#1054
Compile failing when partial is an instance of Handlebars.SafeString#1054raiden-dev wants to merge 1 commit intohandlebars-lang:masterfrom raiden-dev:master
Conversation
|
Can you add a test to ensure that this does not regress and I'll be glad to On Tue, Jul 7, 2015 at 8:05 PM Andrey Kravtsov [email protected]
|
|
I'm little bit unsure about exact solution to this problem. Should partial always return a string only? |
|
You raise an interesting point. I was surprised that you were able to cause a safe string return from a partial in the first place. Modifying your example a little bit, http://jsfiddle.net/j1j60b0u/1/, shows that a template with a simple wrapper can return a SafeString as well, which could lead to issues down the road. I think we need to make sure that the return from any template, partial or not, is always a string and have proper tests to ensure that :) |
|
@RD5, I went the route of consistent string return from the API and implemented your test case there. Thanks for the report! |
|
Thank you! |
Certain optimizations for simple templates could result in objects returned by helpers returned rather than their string representation, resulting in some odd edge cases. This ensures that strings are always returned from the API for consistency. Fixes handlebars-lang#1054.
When partial's
indentoption is used, runtime compilation of string partial is failing for partials produced byHandlebars.SafeStringbecause ofsplitmethod call.https://github.com/wycats/handlebars.js/blob/master/lib/handlebars/runtime.js#L52
See jsfiddle demo for details.
I have fixed it in a straight way by explicitly calling
result.toString().