title: KnockoutJS template doesn't work in IE8, gives binding error
body: <p>I've got the following KnockoutJS 2.0 code that works fine in all modern browsers, but fails on IE8.</p>
  
  <p>Here's the simplified code:</p>
  
  <pre><code>&lt;table&gt;
     &lt;tr&gt;
         &lt;td data-bind="template: { foreach: fooItems, name: 'foo-template' }&gt;&lt;/td&gt;
         &lt;td data-bind="template: { foreach: barItems, name: 'foo-template' }&gt;&lt;/td&gt;
     &lt;/tr&gt;
  &lt;/table&gt;
  
  &lt;script id="foo-template" type="text/html"&gt;
     &lt;div data-bind="click: SomeMethod"&gt;
         foobar
     &lt;/div&gt;
  &lt;/script&gt;
  
  &lt;script type="text/javascript"&gt;
  
     var viewModel = {
         fooItems: ko.observableArray(),
         barItems: ko.observableArray(),
     }
     ko.applyBindings(viewModel);
  
  &lt;/script&gt;
  </code></pre>
  
  <p>This works fine on IE9, Chrome, Firefox.</p>
  
  <p>However, on IE8, I get the following error: </p>
  
  <blockquote>
    <p>"Unable to parse bindings. SomeMethod is undefined."</p>
  </blockquote>
  
  <p>Debugging this in IE8, I see the following information:</p>
  
  <p><img src="https://i.stack.imgur.com/73WzS.jpg" alt="enter image description here"></p>
  
  <p>It's about to throw the exception, and it's coming during the rendering of the foo-template. </p>
  
  <p><strong>Notice that $data is undefined.</strong> That's why SomeMethod is not resolving; it should exist on $data.SomeMethod, but $data is undefined. </p>
  
  <p>Why is this failing on IE8? </p>