Upon upgrading from 4.5.1 to 4.5.2 certain templates started to break/behave in unexpected ways. In particular constructs like the following break now:
Definition of the handlebars helper:
handlebars.registerHelper("test.helper", new Helper<String>() {
@Override
public Object apply(String text, Options options) {
return "Hello " + text;
}
});
Usage:
{{#each names as |name|}}
{{test.helper name}}
{{/each}}
With context:
{
"names": ["John", "Jeff"]
}
For:
Template template = handlebars.compileInline("{{#each names as |name|}}{{test.helper name}}{{/each}}");
System.out.println(template.apply(context));
The result would be Hello JohnHello Jeff on 4.5.1, but is empty on 4.5.2.
The root cause seems to be the change made to solve issue 820, namely the changed conditional in Variable#value (link). Effectively the new conditional now enforces that helpers may not contain a ., a behaviour which was allowed before the change and breaks existing templates relying on the old behaviour.
Upon upgrading from 4.5.1 to 4.5.2 certain templates started to break/behave in unexpected ways. In particular constructs like the following break now:
Definition of the handlebars helper:
Usage:
With context:
{ "names": ["John", "Jeff"] }For:
The result would be
Hello JohnHello Jeffon 4.5.1, but is empty on 4.5.2.The root cause seems to be the change made to solve issue 820, namely the changed conditional in
Variable#value(link). Effectively the new conditional now enforces that helpers may not contain a., a behaviour which was allowed before the change and breaks existing templates relying on the old behaviour.