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

{{#if}} statement within partial gets displayed outside partial #2186

Closed
phillipskevin opened this Issue Jan 13, 2016 · 6 comments

Comments

Projects
None yet
4 participants
@phillipskevin
Collaborator

phillipskevin commented Jan 13, 2016

If a template displays a partial under a certain condition (showPartial in my example), like:

  {{#if showPartial}}
    {{>mypartial}}
  {{/if}}

and then the partial also displays something based on another condition (showHiddenSection):

<script id="mypartial" type="text/stache">
{{#if showHiddenSection}}
  <h4>Hidden Section of Partial</h4>
{{/if}}
</script>

It is possible to cause the hidden section to be displayed entirely outside of the partial.
Here is a GIF showing the hidden section repeatedly duplicated outside of the partial:

partial-issue

And here is a JS Bin of the code: http://jsbin.com/zuvofuyuri/1/edit?html,js,output

@justinbmeyer

This comment has been minimized.

Show comment
Hide comment
@justinbmeyer

justinbmeyer Jan 13, 2016

Contributor

Thanks @phillipskevin . Anyway you can remove the use of the component and routing? It will be probably ready for a quick insertion into a test at that point. Thanks again.

Contributor

justinbmeyer commented Jan 13, 2016

Thanks @phillipskevin . Anyway you can remove the use of the component and routing? It will be probably ready for a quick insertion into a test at that point. Thanks again.

@justinbmeyer justinbmeyer added the bug label Jan 13, 2016

@justinbmeyer justinbmeyer added this to the 2.3.10 milestone Jan 13, 2016

@phillipskevin

This comment has been minimized.

Show comment
Hide comment
@phillipskevin

phillipskevin Jan 13, 2016

Collaborator

@justinbmeyer, here is a simplified example: http://jsbin.com/dizuxanide/edit?html,js,output.

If you point me to the right place, I can attempt to put in a test.

Collaborator

phillipskevin commented Jan 13, 2016

@justinbmeyer, here is a simplified example: http://jsbin.com/dizuxanide/edit?html,js,output.

If you point me to the right place, I can attempt to put in a test.

@justinbmeyer

This comment has been minimized.

Show comment
Hide comment
@justinbmeyer

justinbmeyer Jan 14, 2016

Contributor

@phillipskevin It would be in can/view/stache/stache_test.js. Ideally you shouldn't have to append it to the DOM like the vast majority of the other tests.

Contributor

justinbmeyer commented Jan 14, 2016

@phillipskevin It would be in can/view/stache/stache_test.js. Ideally you shouldn't have to append it to the DOM like the vast majority of the other tests.

@justinbmeyer

This comment has been minimized.

Show comment
Hide comment
@justinbmeyer

justinbmeyer Jan 14, 2016

Contributor

@phillipskevin I'd be interested if #2189 fixes it. You might try to make that small change locally and see if your problem sticks around.

Contributor

justinbmeyer commented Jan 14, 2016

@phillipskevin I'd be interested if #2189 fixes it. You might try to make that small change locally and see if your problem sticks around.

@phillipskevin

This comment has been minimized.

Show comment
Hide comment
@phillipskevin

phillipskevin Jan 14, 2016

Collaborator

@justinbmeyer the fix for #2189 doesn't resolve my issue. I should have time to submit a test for this tomorrow.

Collaborator

phillipskevin commented Jan 14, 2016

@justinbmeyer the fix for #2189 doesn't resolve my issue. I should have time to submit a test for this tomorrow.

@phillipskevin

This comment has been minimized.

Show comment
Hide comment
Collaborator

phillipskevin commented Jan 14, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment