public/lib/emberjs/ember.js
function(classBindings) {
        var classNames = this.classNames;
        var elem, newClass, dasherizedClass;

        // Loop through all of the configured bindings. These will be either
        // property names ('isUrgent') or property paths relative to the view
        // ('content.isUrgent')
        forEach(classBindings, function(binding) {

          Ember.assert("classNameBindings must not have spaces in them. Multiple class name bindings can be provided as elements of an array, e.g. ['foo', ':bar']", binding.indexOf(' ') === -1);

          // Variable in which the old class value is saved. The observer function
          // closes over this variable, so it knows which string to remove when
          // the property changes.
          var oldClass;
          // Extract just the property name from bindings like 'foo:bar'
          var parsedPath = View._parsePropertyPath(binding);

          // Set up an observer on the context. If the property changes, toggle the
          // class name.
          var observer = function() {
            // Get the current value of the property
            newClass = this._classStringForProperty(binding);
            elem = this.$();

            // If we had previously added a class to the element, remove it.
            if (oldClass) {
              elem.removeClass(oldClass);
              // Also remove from classNames so that if the view gets rerendered,
              // the class doesn't get added back to the DOM.
              classNames.removeObject(oldClass);
            }

            // If necessary, add a new class. Make sure we keep track of it so
            // it can be removed in the future.
            if (newClass) {
              elem.addClass(newClass);
              oldClass = newClass;
            } else {
              oldClass = null;
            }
          };

          // Get the class name for the property at its current value
          dasherizedClass = this._classStringForProperty(binding);

          if (dasherizedClass) {
            // Ensure that it gets into the classNames array
            // so it is displayed when we render.
            addObject(classNames, dasherizedClass);

            // Save a reference to the class name so we can remove it
            // if the observer fires. Remember that this variable has
            // been closed over by the observer.
            oldClass = dasherizedClass;
          }

          this.registerObserver(this, parsedPath.path, observer);
          // Remove className so when the view is rerendered,
          // the className is added based on binding reevaluation
          this.one('willClearRender', function() {
            if (oldClass) {
              classNames.removeObject(oldClass);
              oldClass = null;
            }
          });

        }, this);
      }
function(classBindings) {
        var classNames = this.classNames;
        var elem, newClass, dasherizedClass;

        // Loop through all of the configured bindings. These will be either
        // property names ('isUrgent') or property paths relative to the view
        // ('content.isUrgent')
        forEach(classBindings, function(binding) {

          Ember.assert("classNameBindings must not have spaces in them. Multiple class name bindings can be provided as elements of an array, e.g. ['foo', ':bar']", binding.indexOf(' ') === -1);

          // Variable in which the old class value is saved. The observer function
          // closes over this variable, so it knows which string to remove when
          // the property changes.
          var oldClass;
          // Extract just the property name from bindings like 'foo:bar'
          var parsedPath = View._parsePropertyPath(binding);

          // Set up an observer on the context. If the property changes, toggle the
          // class name.
          var observer = function() {
            // Get the current value of the property
            newClass = this._classStringForProperty(binding);
            elem = this.$();

            // If we had previously added a class to the element, remove it.
            if (oldClass) {
              elem.removeClass(oldClass);
              // Also remove from classNames so that if the view gets rerendered,
              // the class doesn't get added back to the DOM.
              classNames.removeObject(oldClass);
            }

            // If necessary, add a new class. Make sure we keep track of it so
            // it can be removed in the future.
            if (newClass) {
              elem.addClass(newClass);
              oldClass = newClass;
            } else {
              oldClass = null;
            }
          };

          // Get the class name for the property at its current value
          dasherizedClass = this._classStringForProperty(binding);

          if (dasherizedClass) {
            // Ensure that it gets into the classNames array
            // so it is displayed when we render.
            addObject(classNames, dasherizedClass);

            // Save a reference to the class name so we can remove it
            // if the observer fires. Remember that this variable has
            // been closed over by the observer.
            oldClass = dasherizedClass;
          }

          this.registerObserver(this, parsedPath.path, observer);
          // Remove className so when the view is rerendered,
          // the className is added based on binding reevaluation
          this.one('willClearRender', function() {
            if (oldClass) {
              classNames.removeObject(oldClass);
              oldClass = null;
            }
          });

        }, this);
      }
function ( classBindings ) { var classNames = this . classNames ; var elem , newClass , dasherizedClass ; // Loop through all of the configured bindings. These will be either // property names ('isUrgent') or property paths relative to the view // ('content.isUrgent') forEach ( classBindings , function ( binding ) { Ember . assert ( "classNameBindings must not have spaces in them. Multiple class name bindings can be provided as elements of an array, e.g. ['foo', ':bar']" , binding . indexOf ( ' ' ) === - 1 ) ; // Variable in which the old class value is saved. The observer function // closes over this variable, so it knows which string to remove when // the property changes. var oldClass ; // Extract just the property name from bindings like 'foo:bar' var parsedPath = View . _parsePropertyPath ( binding ) ; // Set up an observer on the context. If the property changes, toggle the // class name. var observer = function ( ) { // Get the current value of the property newClass = this . _classStringForProperty ( binding ) ; elem = this . $ ( ) ; // If we had previously added a class to the element, remove it. if ( oldClass ) { elem . removeClass ( oldClass ) ; // Also remove from classNames so that if the view gets rerendered, // the class doesn't get added back to the DOM. classNames . removeObject ( oldClass ) ; } // If necessary, add a new class. Make sure we keep track of it so // it can be removed in the future. if ( newClass ) { elem . addClass ( newClass ) ; oldClass = newClass ; } else { oldClass = null ; } } ; // Get the class name for the property at its current value dasherizedClass = this . _classStringForProperty ( binding ) ; if ( dasherizedClass ) { // Ensure that it gets into the classNames array // so it is displayed when we render. addObject ( classNames , dasherizedClass ) ; // Save a reference to the class name so we can remove it // if the observer fires. Remember that this variable has // been closed over by the observer. oldClass = dasherizedClass ; } this . registerObserver ( this , parsedPath . path , observer ) ; // Remove className so when the view is rerendered, // the className is added based on binding reevaluation this . one ( 'willClearRender' , function ( ) { if ( oldClass ) { classNames . removeObject ( oldClass ) ; oldClass = null ; } } ) ; } , this ) ; }
Iterates over the view's `classNameBindings` array, inserts the value
of the specified property into the `classNames` array, then creates an
observer to update the view's element if the bound property ever changes
in the future.

@method _applyClassNameBindings
@private
Iterates over the view s classNameBindings array inserts the value of the specified property into the classNames array then creates an observer to update the view s element if the bound property ever changes in the future .