-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Strange context change behavior when custom helper inside #each (v4.0.5) #1135
Labels
Comments
Thanks for the report. Something certainly seems wrong here. Will have to take a look. |
The issue here is the use of |
Thank you for the fix! |
lawnsea
pushed a commit
to lawnsea/handlebars.js
that referenced
this issue
Nov 9, 2016
lawnsea
pushed a commit
that referenced
this issue
Nov 11, 2016
nknapp
pushed a commit
that referenced
this issue
Mar 9, 2017
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
Please refer to this jsfiddle: http://jsfiddle.net/7ywsdydr/ .
Base on #1028 , when a block customhelper execute options.fn(this) , the context stack should not be pushed.
Here is test 1 to confirm the behavior:
The input data is:
The test 1 output is:
Compare output 1.IF and 2.MYIF we can know the context is not changed when inside the {{#if}} or {{#myif}} block. The {{#myif}} helper is defined as:
Which almost same with {{#if}}. But, when this test be placed into a {{#each}} :
Output will be:
Note on difference between 1.IF and 2.MYIF . The issue is: when {{#if}} do not change the context, in the same time {{#myif}} changed the context. Why?
The text was updated successfully, but these errors were encountered: