SteveSanderson/knockout — pull request #674 by devdoc (2012-10-16 20:40:05+00:00)
Title: Make buildEvalWithinScopeFunction() work with AMD-knockout

I tried using [Ryan's advice](http://stackoverflow.com/questions/9261296/any-good-techniques-to-debug-template-binding-faults-for-knockout-js) to debug some bindings in a project RequireJS to load Knockout, and got a 'ko is undefined' error. I found the reason to be that Knockout's buildEvalWithinScopeFunction() uses the Function construcor to create an evaluator for the binding expression: that means it gets evaluated in the global scope, which in my AMD environment did not contain the ko variable. In contrast, using eval() allows the evaluator function to be defined normally and run in the local scope, where ko is accessible as a loaded AMD module. I altered the function as in this commit and got binding expressions referring to ko working. Not sure if this has performance or other important implications.

There seem to be some similarities with this issue and issue #490.