js/libs/ember-1.5.1.js
function bind(property, options, preserveContext, shouldDisplay, valueNormalizer, childProperties) {
  var data = options.data,
      fn = options.fn,
      inverse = options.inverse,
      view = data.view,
      currentContext = this,
      normalized, observer, i;

  normalized = normalizePath(currentContext, property, data);

  // Set up observers for observable objects
  if ('object' === typeof this) {
    if (data.insideGroup) {
      observer = function() {
        Ember.run.once(view, 'rerender');
      };

      var template, context, result = handlebarsGet(currentContext, property, options);

      result = valueNormalizer ? valueNormalizer(result) : result;

      context = preserveContext ? currentContext : result;
      if (shouldDisplay(result)) {
        template = fn;
      } else if (inverse) {
        template = inverse;
      }

      template(context, { data: options.data });
    } else {
      // Create the view that will wrap the output of this template/property
      // and add it to the nearest view's childViews array.
      // See the documentation of Ember._HandlebarsBoundView for more.
      var bindView = view.createChildView(Ember._HandlebarsBoundView, {
        preserveContext: preserveContext,
        shouldDisplayFunc: shouldDisplay,
        valueNormalizerFunc: valueNormalizer,
        displayTemplate: fn,
        inverseTemplate: inverse,
        path: property,
        pathRoot: currentContext,
        previousContext: currentContext,
        isEscaped: !options.hash.unescaped,
        templateData: options.data
      });

      if (options.hash.controller) {
        bindView.set('_contextController', this.container.lookupFactory('controller:'+options.hash.controller).create({
          container: currentContext.container,
          parentController: currentContext,
          target: currentContext
        }));
      }

      view.appendChild(bindView);

      observer = function() {
        Ember.run.scheduleOnce('render', bindView, 'rerenderIfNeeded');
      };
    }

    // Observes the given property on the context and
    // tells the Ember._HandlebarsBoundView to re-render. If property
    // is an empty string, we are printing the current context
    // object ({{this}}) so updating it is not our responsibility.
    if (normalized.path !== '') {
      view.registerObserver(normalized.root, normalized.path, observer);
      if (childProperties) {
        for (i=0; i<childProperties.length; i++) {
          view.registerObserver(normalized.root, normalized.path+'.'+childProperties[i], observer);
        }
      }
    }
  } else {
    // The object is not observable, so just render it out and
    // be done with it.
    data.buffer.push(handlebarsGetEscaped(currentContext, property, options));
  }
}
function bind(property, options, preserveContext, shouldDisplay, valueNormalizer, childProperties) {
  var data = options.data,
      fn = options.fn,
      inverse = options.inverse,
      view = data.view,
      currentContext = this,
      normalized, observer, i;

  normalized = normalizePath(currentContext, property, data);

  // Set up observers for observable objects
  if ('object' === typeof this) {
    if (data.insideGroup) {
      observer = function() {
        Ember.run.once(view, 'rerender');
      };

      var template, context, result = handlebarsGet(currentContext, property, options);

      result = valueNormalizer ? valueNormalizer(result) : result;

      context = preserveContext ? currentContext : result;
      if (shouldDisplay(result)) {
        template = fn;
      } else if (inverse) {
        template = inverse;
      }

      template(context, { data: options.data });
    } else {
      // Create the view that will wrap the output of this template/property
      // and add it to the nearest view's childViews array.
      // See the documentation of Ember._HandlebarsBoundView for more.
      var bindView = view.createChildView(Ember._HandlebarsBoundView, {
        preserveContext: preserveContext,
        shouldDisplayFunc: shouldDisplay,
        valueNormalizerFunc: valueNormalizer,
        displayTemplate: fn,
        inverseTemplate: inverse,
        path: property,
        pathRoot: currentContext,
        previousContext: currentContext,
        isEscaped: !options.hash.unescaped,
        templateData: options.data
      });

      if (options.hash.controller) {
        bindView.set('_contextController', this.container.lookupFactory('controller:'+options.hash.controller).create({
          container: currentContext.container,
          parentController: currentContext,
          target: currentContext
        }));
      }

      view.appendChild(bindView);

      observer = function() {
        Ember.run.scheduleOnce('render', bindView, 'rerenderIfNeeded');
      };
    }

    // Observes the given property on the context and
    // tells the Ember._HandlebarsBoundView to re-render. If property
    // is an empty string, we are printing the current context
    // object ({{this}}) so updating it is not our responsibility.
    if (normalized.path !== '') {
      view.registerObserver(normalized.root, normalized.path, observer);
      if (childProperties) {
        for (i=0; i<childProperties.length; i++) {
          view.registerObserver(normalized.root, normalized.path+'.'+childProperties[i], observer);
        }
      }
    }
  } else {
    // The object is not observable, so just render it out and
    // be done with it.
    data.buffer.push(handlebarsGetEscaped(currentContext, property, options));
  }
}
function bind ( property , options , preserveContext , shouldDisplay , valueNormalizer , childProperties ) { var data = options . data , fn = options . fn , inverse = options . inverse , view = data . view , currentContext = this , normalized , observer , i ; normalized = normalizePath ( currentContext , property , data ) ; // Set up observers for observable objects if ( 'object' === typeof this ) { if ( data . insideGroup ) { observer = function ( ) { Ember . run . once ( view , 'rerender' ) ; } ; var template , context , result = handlebarsGet ( currentContext , property , options ) ; result = valueNormalizer ? valueNormalizer ( result ) : result ; context = preserveContext ? currentContext : result ; if ( shouldDisplay ( result ) ) { template = fn ; } else if ( inverse ) { template = inverse ; } template ( context , { data : options . data } ) ; } else { // Create the view that will wrap the output of this template/property // and add it to the nearest view's childViews array. // See the documentation of Ember._HandlebarsBoundView for more. var bindView = view . createChildView ( Ember . _HandlebarsBoundView , { preserveContext : preserveContext , shouldDisplayFunc : shouldDisplay , valueNormalizerFunc : valueNormalizer , displayTemplate : fn , inverseTemplate : inverse , path : property , pathRoot : currentContext , previousContext : currentContext , isEscaped : ! options . hash . unescaped , templateData : options . data } ) ; if ( options . hash . controller ) { bindView . set ( '_contextController' , this . container . lookupFactory ( 'controller:' + options . hash . controller ) . create ( { container : currentContext . container , parentController : currentContext , target : currentContext } ) ) ; } view . appendChild ( bindView ) ; observer = function ( ) { Ember . run . scheduleOnce ( 'render' , bindView , 'rerenderIfNeeded' ) ; } ; } // Observes the given property on the context and // tells the Ember._HandlebarsBoundView to re-render. If property // is an empty string, we are printing the current context // object ({{this}}) so updating it is not our responsibility. if ( normalized . path !== '' ) { view . registerObserver ( normalized . root , normalized . path , observer ) ; if ( childProperties ) { for ( i = 0 ; i < childProperties . length ; i ++ ) { view . registerObserver ( normalized . root , normalized . path + '.' + childProperties [ i ] , observer ) ; } } } } else { // The object is not observable, so just render it out and // be done with it. data . buffer . push ( handlebarsGetEscaped ( currentContext , property , options ) ) ; } }
Binds a property into the DOM. This will create a hook in DOM that the KVO system will look for and update if the property changes.
Binds a property into the DOM . This will create a hook in DOM that the KVO system will look for and update if the property changes .