These days to see some of the mvc4/5 things, basically and MVC 3 are the same, looks effortless, the project has not officially started, every day is to see the document, understand technology. Idle bored on the knockout JS to see it again. Today, while looking at SIGNALR, I wrote a paragraph of test code, found that the virtual label knockout a bit of a problem, at first I wrote this:
<table> <tr data-bind= "Foreach:msgs" > <td data-bind= "text:name" ></td> <TD data-bind= "text:msg" ></td> </tr> </table>
The discovery loop occurs on the TD's internal, which generates columns instead of rows.
Into:
<table>
<!--ko foreach:msgs-->
<tr>
<td data-bind= "Text:name" ></td>
<td data-bind= "text:msg" ></td>
</tr>
<!--/ko-->
</table>
Incredibly hint:
Cannot find closing comment tag to Match:ko foreach:msgs
Read the HTML carefully, did not find a closed tag, the syntax is not wrong. TD Riga content also no avail.
To navigate to the Knockout-3.1.0.debug.js Getvirtualchildren method, the incoming argument is a Comment, that is, the virtual label.
Looking at its father to look like who:
The following is followed by a while loop:
while (CurrentNode = currentnode.nextsibling) {
The goal is to loop the judgment and the Comment at the same level is not a Comment, that is, at the same level to find the virtual label of the closing tag, unfortunately, in the upper part of the HTML, did not find the closure of the virtual tag, but on the surface, It does have a corresponding closure.
Why is that?
Back to the column page: http://www.bianceng.cnhttp://www.bianceng.cn/webkf/script/