Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix helpers with recent Handlebars and improve server-side compatibility #4

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

chromakode
Copy link

I believe I've discovered a fix for #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. :)

Handlebars helpers were broken due to `nameLookup` generating an
unexpected ternary in the compiled code's helper lookup expression.
This eases compatibility with jQuery analogues like cheerio.
This helps when running in a non-browser environment like node.
@loicfrering
Copy link
Owner

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?

@chromakode
Copy link
Author

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

@loicfrering
Copy link
Owner

Great, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants