dist/tko.binding.if.js
function updateContext() {
          // Most of the time, the context will directly get a view model object, but if a function is given,
          // we call the function to retrieve the view model. If the function accesses any observables or returns
          // an observable, the dependency is tracked, and those observables can later cause the binding
          // context to be updated.
          var dataItemOrObservable = isFunc ? dataItemOrAccessor() : dataItemOrAccessor,
              dataItem = unwrap(dataItemOrObservable);

          if (parentContext) {
              // When a "parent" context is given, register a dependency on the parent context. Thus whenever the
              // parent context is updated, this context will also be updated.
              if (parentContext._subscribable)
                  parentContext._subscribable();

              // Copy $root and any custom properties from the parent context
              extend(self, parentContext);

              // Because the above copy overwrites our own properties, we need to reset them.
              self._subscribable = subscribable;
          } else {
              self.$parents = [];
              self.$root = dataItem;

              // Export 'ko' in the binding context so it will be available in bindings and templates
              // even if 'ko' isn't exported as a global, such as when using an AMD loader.
              // See https://github.com/SteveSanderson/knockout/issues/490
              self.ko = options.knockoutInstance;
          }
          self.$rawData = dataItemOrObservable;
          self.$data = dataItem;
          if (dataItemAlias)
              self[dataItemAlias] = dataItem;

          // The extendCallback function is provided when creating a child context or extending a context.
          // It handles the specific actions needed to finish setting up the binding context. Actions in this
          // function could also add dependencies to this binding context.
          if (extendCallback)
              extendCallback(self, parentContext, dataItem);

          return self.$data;
      }
function updateContext() {
          // Most of the time, the context will directly get a view model object, but if a function is given,
          // we call the function to retrieve the view model. If the function accesses any observables or returns
          // an observable, the dependency is tracked, and those observables can later cause the binding
          // context to be updated.
          var dataItemOrObservable = isFunc ? dataItemOrAccessor() : dataItemOrAccessor,
              dataItem = unwrap(dataItemOrObservable);

          if (parentContext) {
              // When a "parent" context is given, register a dependency on the parent context. Thus whenever the
              // parent context is updated, this context will also be updated.
              if (parentContext._subscribable)
                  parentContext._subscribable();

              // Copy $root and any custom properties from the parent context
              extend(self, parentContext);

              // Because the above copy overwrites our own properties, we need to reset them.
              self._subscribable = subscribable;
          } else {
              self.$parents = [];
              self.$root = dataItem;

              // Export 'ko' in the binding context so it will be available in bindings and templates
              // even if 'ko' isn't exported as a global, such as when using an AMD loader.
              // See https://github.com/SteveSanderson/knockout/issues/490
              self.ko = options.knockoutInstance;
          }
          self.$rawData = dataItemOrObservable;
          self.$data = dataItem;
          if (dataItemAlias)
              self[dataItemAlias] = dataItem;

          // The extendCallback function is provided when creating a child context or extending a context.
          // It handles the specific actions needed to finish setting up the binding context. Actions in this
          // function could also add dependencies to this binding context.
          if (extendCallback)
              extendCallback(self, parentContext, dataItem);

          return self.$data;
      }
function updateContext ( ) { // Most of the time, the context will directly get a view model object, but if a function is given, // we call the function to retrieve the view model. If the function accesses any observables or returns // an observable, the dependency is tracked, and those observables can later cause the binding // context to be updated. var dataItemOrObservable = isFunc ? dataItemOrAccessor ( ) : dataItemOrAccessor , dataItem = unwrap ( dataItemOrObservable ) ; if ( parentContext ) { // When a "parent" context is given, register a dependency on the parent context. Thus whenever the // parent context is updated, this context will also be updated. if ( parentContext . _subscribable ) parentContext . _subscribable ( ) ; // Copy $root and any custom properties from the parent context extend ( self , parentContext ) ; // Because the above copy overwrites our own properties, we need to reset them. self . _subscribable = subscribable ; } else { self . $parents = [ ] ; self . $root = dataItem ; // Export 'ko' in the binding context so it will be available in bindings and templates // even if 'ko' isn't exported as a global, such as when using an AMD loader. // See https://github.com/SteveSanderson/knockout/issues/490 self . ko = options . knockoutInstance ; } self . $rawData = dataItemOrObservable ; self . $data = dataItem ; if ( dataItemAlias ) self [ dataItemAlias ] = dataItem ; // The extendCallback function is provided when creating a child context or extending a context. // It handles the specific actions needed to finish setting up the binding context. Actions in this // function could also add dependencies to this binding context. if ( extendCallback ) extendCallback ( self , parentContext , dataItem ) ; return self . $data ; }
The binding context object includes static properties for the current, parent, and root view models. If a view model is actually stored in an observable, the corresponding binding context object, and any child contexts, must be updated when the view model is changed.
The binding context object includes static properties for the current parent and root view models . If a view model is actually stored in an observable the corresponding binding context object and any child contexts must be updated when the view model is changed .