backbone.handlebars icon indicating copy to clipboard operation
backbone.handlebars copied to clipboard

Fix helpers with recent Handlebars and improve server-side compatibility

Open chromakode opened this issue 11 years ago • 3 comments

I believe I've discovered a fix for https://github.com/loicfrering/backbone.handlebars/issues/2 while hacking around running this module server-side tonight. It looks like Handlebars is applying the nameLookup function to helper lookups now, generating code like this:

+ escapeExpression((helper = helpers.get ? helpers.get('view') : helpers.view || depth0.get ? depth0.get('view') : (depth0 && depth0.view),options={...

I'd guess that order of operations is causing this to have an unexpected result. Surrounding the nameLookup output with parentheses got things working again. :)

chromakode avatar Feb 07 '14 08:02 chromakode

Awesome, thanks a lot @chromakode!

In order to be merged, could you please update the according test to get a successful build on Travis CI?

loicfrering avatar Feb 07 '14 20:02 loicfrering

Sorry, missed your reply for some reason. Will do!

chromakode avatar Feb 24 '14 11:02 chromakode

Great, thanks!

loicfrering avatar Feb 25 '14 08:02 loicfrering