嵌套的无容器foreach in tbody失败了IE

时间:2012-12-06 16:55:00

标签: javascript internet-explorer knockout.js

我在使用一些嵌套的,无容器的foreach绑定时遇到了一些麻烦。它适用于成人浏览器,但不适用于IE(8或9)。

我能找到的最接近的是this question,但问题的根源似乎是缺少tbody标签,我有。 IE提供的错误是

  

无法找到要匹配的结束评论标记:ko foreach:seniors

对不起文字墙,但下面是我的标记。


<tbody data-bind="foreach: superGroups">
    <tr>
        <td style="font-weight: bold;" data-bind="text: superName() || 'No Super Set'" colspan="8">
    </tr>
    <!-- ko foreach: seniors -->
    <tr>
        <td></td>
        <td style="font-weight: bold;" data-bind="text: seniorName() || 'No Senior Set'" colspan="7"></td>
    </tr>

        <!-- ko foreach: items -->

        <tr>
            <td>
                <span data-bindX="text:superName"></span>
            </td>
            <td>
                <span data-bindX="text:seniorName"></span>
            </td>
            <td>
                <span data-bind="text:clientName"></span>
                <i class="icon-tags" data-bind="attr:{title: labels}, visible: labels"></i>
            </td>
            <td>
                <span data-bind="text:description"></span>
            </td>
            <td>
                <span data-bind="visible:superPayAmount">$<span data-bind="text:superPayAmount"></span></span>
                <span data-bind="visible:superPayAmount.length == 0">-</span>
            </td>
            <td>
                <span data-bind="shortDate: superStartDate"></span> - <span data-bind="shortDate: superEndDate"></span>
            </td>
            <td>
                <span data-bind="visible:seniorPayAmount">$<span data-bind="text:seniorPayAmount"></span></span>
                <span data-bind="visible:!seniorPayAmount.length == 0">-</span>
            </td>
            <td>
                <span data-bind="shortDate: seniorStartDate"></span> - <span data-bind="shortDate: seniorEndDate"></span>
            </td>
        </tr>

        <!-- /ko -->

    <!-- /ko -->
</tbody>

1 个答案:

答案 0 :(得分:4)

您错过了第一个td

中的tr代码
<tr>
    <td style="font-weight: bold;" data-bind="text: superName() || 'No Super Set'" colspan="8"></td>
</tr>