mbest/knockout.punches

Punches flow control in table structures

Closed this issue · 3 comments

I'm not sure if this is something that can be fixed in punches or if it is the browser (chrome in my instance) moving things but I'm trying to use if statements to control what elements of a table are displayed. Unless used within a td it does the following:

Markup:

<div>
    <table>
    {{#if: displayData}}
        <thead>
            ...
        </thead>
    {{/if}}
        <tbody>
        {{#if: displayData}}
            ...
        {{/if}}
        </tbody>
    </table>
</div>

Expected:

<div>
    <table>
    <!-- ko if: displayData -->
        <thead>
            ...
        </thead>
    <!-- /ko -->
        <tbody>
        <!-- ko if: displayData -->
            ...
        <!-- /ko -->
        </tbody>
    </table>
</div>

Generated:

<div>
    <!-- ko if: displayData -->
    <!-- /ko -->
    <!-- ko if: displayData -->
    <!-- /ko -->
    <table>
        <thead>
            ...
        </thead>
        <tbody>
            ...
        </tbody>
    </table>
</div>

Seems to be the same in firefox, opera, safari, and IE

Unfortunately, within tables, you'll need to use the comment syntax directly.

No problem. I thought this might be the case and thought you'd probably be aware. Could be worth putting a one liner on your readme/website.

Thanks.