SteveSanderson/knockout — Issue #189: a couple of coding practice questions
Author: normanzb
Created: 2011-11-01 19:26:12+00:00
State: open

#1
https://github.com/SteveSanderson/knockout/blob/master/src/utils.domNodeDisposal.js#L2

why 'new'? it is unnecessary to 'new' because the 'constructor' will return a object and there is no reference to 'this'.

'new' it will cause 2 object actually created, the first object is the one being returned, another one is created by 'new'.

// this is a simple test that proves 2 object was created.
foo =new (function(){var scope = this; return {actual: scope}});
console.log(foo.actual);

#2
https://github.com/SteveSanderson/knockout/blob/master/src/subscribables/mappingHelpers.js#L31

what if rootObject is an array which created in the other document? let's say, the array created in an iframe?

#3
https://github.com/SteveSanderson/knockout/blob/master/src/subscribables/mappingHelpers.js#L27
what if i use a function as viewModel to holding observables?

#4
https://github.com/SteveSanderson/knockout/blob/master/src/subscribables/dependentObservable.js#L19

the implementation of dependentObservable is inefficient because
every time it gets called it creates another copy of function disposeAllSubscriptionsToDependencies, evaluatePossiblyAsync and evaluateImmediate ... etc