Handle nested scoping in foreach template

If you have a nested foreach or any other construct that creates a nested scope the selection model will not handle clicks on elements in the nested scope:

    <ul data-bind="foreach: [0,1,2,3,4,5], selection: selection">
      <li data-bind="foreach: [0,1,2,3,4,5]">
        <div data-bind="text: $data"></div>
      </li>
    </ul>

Clicking on the div-element will not select the parent li-element.

The pull request fixes this by walking up the context chain.