added $index value in the binding context of foreach templates.
forgot this function also requires the index.
new test, this one makes sure that the indices update as the relevant nodes move around.
first guess at how to support modifying observable indices.
comments.
we need to create the new indices by tracking added and retained nodes, using i is insufficient.
finally cracked it. the problem was duplicate context creation.

it is also necessary to perform double buffering of the stored contexts such
that we do not overwrite new nodes or move new nodes by mistake.
Merge branch 'master' into foreach-context-index

* master:
  More indentation tweaks for tidiness
  Update the build
  Minor indentation tweaks
  Stylistic tweaks to previous commit
  Eliminate redundant IE6/7 workarounds for radio/checkbox issues. These problems no longer apply now that bindings are always applied to elements after they've been put into the DOM. Fixes issue #169
  Refactor bad code
  minor fix
  Fix render array with \"undefined\" and \"null\" items in \"foreach\"  template
  Updated remove and removeAll to modify their underlying arrays rather than creating new arrays. This makes them consistent with the rest of the array write functions. Added tests to verify original array is modified. Also added test to verify there is no notification when nothing is removed.
  changing IE detection to not rely on user agents
  Fixed a variable which should not have been global.
Merge branch 'master' into foreach-context-index

Conflicts:
	spec/templatingBehaviors.js
	src/binding/editDetection/arrayToDomNodeChildren.js
	src/templating/templating.js
Merge branch 'master' into foreach-context-index
Export virtualElements; update bindingAttributeSyntax and templating to work with non-template virtual elements
add spec tests; don't export functions that are not minified
remove allowedVirtualElementBindings export since ko.virtualElements.allowedBindings is now exported as is; remove extra space in spec test
adding the other core changes from #286 :
* Chrome sometimes appends a newline to innerText but not to textContent; so textContent is better in Chrome
* Calling the init and update function on the object means we can use 'this' in the functions.
Reverting the change to invokeForEachNodeOrCommentInParent (until I understand what it was for)
Reverting the way binding handlers' "init" and "update" functions are invoked until the use case is clear.
(Note that, in the future, the custom bindings API may change to become more object oriented, so each binding would
become an object instance that can hold its own data. In case we proceed in that direction, it may be preferable
not to be changing the "init" and "update" semantics in the meantime)
Replace automatic inheritance of all bindingContext properties with new $parentContext variable
Benefit #1: Can reach custom properties on *all* ancestor contexts, and are not limited to those that haven't been overwritten
(e.g., if we had $index, would now be able to reach all ancestor $index values, not just the closest one)
Benefit #2: Allows discrimination between properties at the current level and properties at the parent level, which
is good because not all custom properties may make sense to inherit.
Minor stylistic tweaks to new specs
Force custom bindings to correctly construct child bindingContexts using the parent context by not exporting ko.bindingContext
(i.e., stop custom bindings from calling "new ko.bindingContext" directly)
Extra spec to clarify need for applyBindingsToNodeAndDescendantsInternal to bind descendant elements even if the supplied node is a comment node