title: Knockout Error: Cannot find closing comment tag to match
body: <p>This may seem like a duplicate question, but none of the other answers have helped me.
  I have the following HTML (it's a Razor template, but no Razor specifics here). </p>
  
  <pre><code>&lt;p class="search-results-summary"&gt;
      Results 
      &lt;!-- ko if: SearchTerms.Query --&gt;
      for &lt;span data-bind="html: SearchTerms.Query"&gt;&lt;/span&gt;
      &lt;!-- /ko --&gt;
      &lt;!-- ko if: SearchTerms.Names --&gt;
      for Names &lt;span data-bind="html: SearchTerms.Names.join(', ')"&gt;&lt;/span&gt;
      &lt;!-- /ko --&gt;
      &lt;!-- ko if: SearchTerms.Location &amp;&amp; AlternativeLocations &amp;&amp; AlternativeLocations.length --&gt;
          within &lt;span data-bind="text: SearchTerms.LocationRadio"&gt;&lt;/span&gt;
          miles of &lt;span data-bind="html: SearchTerms.Location"&gt;&lt;/span&gt;. 
          &lt;!-- ko if: AlternativeLocations &amp;&amp; AlternativeLocations.length &gt; 1 --&gt;
              &lt;a class="more alternative-locations" href="#"&gt;more&lt;/a&gt;
              &lt;ul id="other-location-matches" data-bind="foreach: AlternativeLocations.slice(1).sort()" style="display: none"&gt;
                  &lt;li&gt;&amp;gt; Did you mean &lt;a data-bind="html: $data, attr: { href: Edge.API.CurrentSearchResponse.SearchTerms.mutate({ Location: $data }).getUrl() }"&gt;&lt;/a&gt;?&lt;/li&gt;
              &lt;/ul&gt;
          &lt;!-- /ko --&gt;
      &lt;!-- /ko --&gt;
      &lt;!-- ko if: SearchTerms.Location &amp;&amp; (!AlternativeLocations || AlternativeLocations.length == 0) --&gt;
      &lt;span class="error"&gt;We couldn't find '&lt;span data-bind="html: SearchTerms.Location"&gt;&lt;/span&gt;' on the map. Your search ran Worldwide.
      &lt;/span&gt;
      &lt;!-- /ko --&gt;
  &lt;/p&gt;
  </code></pre>
  
  <p>When I try to bind this template using Knockout, I get this error:</p>
  
  <pre><code>Error: Cannot find closing comment tag to match: ko if: SearchTerms.Location &amp;&amp; AlternativeLocations &amp;&amp; AlternativeLocations.length 
  </code></pre>
  
  <p>I have tried:</p>
  
  <ul>
  <li>Upgrading Knockout from 2.2.1 to 2.3.0. No use</li>
  <li>Verifying HTML/XML structure. It's good!</li>
  <li>Removing the <code>&lt;ul id="other-location-matches"...&gt;</code> seems to get rid of the issue... but I need that <code>&lt;ul&gt;</code>!!</li>
  </ul>
  
  <p>Any ideas? Am I looking at a Knockout.js bug?</p>