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

Bug when multiple block helpers are written without space between them #514

Closed
ghost opened this issue May 10, 2013 · 3 comments
Closed

Comments

@ghost
Copy link

ghost commented May 10, 2013

Hi all, I am experiencing some weird problems in some cases with Ember, notably after the update to RC2, reported a bug emberjs/ember.js#2622 but I'm not sure it's an ember or handlebars bug.

Here's what happens:

{{#each filter in App.itemsController}}
{{#view App.MyView}}
...code..
{{/view}}
{{/each}}
just a simple set of views inside an each.

If no characters are put between the #each and the #view, sometimes code belonging to a totally different part of the file is shown on the page. Code that should be hidden, or belonging to another #if, for example.

The issue is fixed if I put an empty char (I use   in my case as the editor strips empty spaces, but any character changes the wrong behavior to a good one).

{{#each filter in App.itemsController}} 
{{#view App.MyView}}
...code..
{{/view}}
{{/each}}

Consider this, which is right: http://jsfiddle.net/eHtgn/
and this, that has the bug: http://jsfiddle.net/WSNpD/1/

The only difference between the 2 is that in the first I added 2 spaces to surround the #each:

 {{#each item in content}} 

This problem is not limited to the couple #each / #view put in a subsequent line, it also happens for example if I put a #unless in the middle, like:

                {{#each filter in App.filters}} 
                  {{#unless filter.isSomething}} 
                    {{#view App.MyView}}

I need a space or something after each block helper, or it does not work. Replicated in chrome, ff, safari.

@ghost ghost closed this as completed May 10, 2013
@ghost ghost reopened this May 10, 2013
@kpdecker
Copy link
Collaborator

I think that this is program deduping bug. Do you still see the issue with https://github.com/wycats/handlebars.js/blob/v1.0.10/dist/handlebars.js?

@DFoxinator
Copy link

This is a dupe of #428 and is fixed in master, but not 1.0.10rc3.

@kpdecker
Copy link
Collaborator

Closing as dupe. We are working towards a rc4 release but in the mean time my recommendation would be to use the v1.0.10 release as the dist content there is identical to what would have been in a client-side release at that point in time.

This issue was closed.
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

No branches or pull requests

2 participants