src/mdlComponentHandler.js
function registerInternal(config) {
    // In order to support both Closure-compiled and uncompiled code accessing
    // this method, we need to allow for both the dot and array syntax for
    // property access. You'll therefore see the `foo.bar || foo['bar']`
    // pattern repeated across this method.
    var widgetMissing = (typeof config.widget === 'undefined' &&
        typeof config['widget'] === 'undefined');
    var widget = true;

    if (!widgetMissing) {
      widget = config.widget || config['widget'];
    }

    var newConfig = /** @type {componentHandler.ComponentConfig} */ ({
      classConstructor: config.constructor || config['constructor'],
      className: config.classAsString || config['classAsString'],
      cssClass: config.cssClass || config['cssClass'],
      widget: widget,
      callbacks: []
    });

    registeredComponents_.forEach(function(item) {
      if (item.cssClass === newConfig.cssClass) {
        throw new Error('The provided cssClass has already been registered: ' + item.cssClass);
      }
      if (item.className === newConfig.className) {
        throw new Error('The provided className has already been registered');
      }
    });

    if (config.constructor.prototype
        .hasOwnProperty(componentConfigProperty_)) {
      throw new Error(
          'MDL component classes must not have ' + componentConfigProperty_ +
          ' defined as a property.');
    }

    var found = findRegisteredClass_(config.classAsString, newConfig);

    if (!found) {
      registeredComponents_.push(newConfig);
    }
  }
function registerInternal(config) {
    // In order to support both Closure-compiled and uncompiled code accessing
    // this method, we need to allow for both the dot and array syntax for
    // property access. You'll therefore see the `foo.bar || foo['bar']`
    // pattern repeated across this method.
    var widgetMissing = (typeof config.widget === 'undefined' &&
        typeof config['widget'] === 'undefined');
    var widget = true;

    if (!widgetMissing) {
      widget = config.widget || config['widget'];
    }

    var newConfig = /** @type {componentHandler.ComponentConfig} */ ({
      classConstructor: config.constructor || config['constructor'],
      className: config.classAsString || config['classAsString'],
      cssClass: config.cssClass || config['cssClass'],
      widget: widget,
      callbacks: []
    });

    registeredComponents_.forEach(function(item) {
      if (item.cssClass === newConfig.cssClass) {
        throw new Error('The provided cssClass has already been registered: ' + item.cssClass);
      }
      if (item.className === newConfig.className) {
        throw new Error('The provided className has already been registered');
      }
    });

    if (config.constructor.prototype
        .hasOwnProperty(componentConfigProperty_)) {
      throw new Error(
          'MDL component classes must not have ' + componentConfigProperty_ +
          ' defined as a property.');
    }

    var found = findRegisteredClass_(config.classAsString, newConfig);

    if (!found) {
      registeredComponents_.push(newConfig);
    }
  }
function registerInternal ( config ) { // In order to support both Closure-compiled and uncompiled code accessing // this method, we need to allow for both the dot and array syntax for // property access. You'll therefore see the `foo.bar || foo['bar']` // pattern repeated across this method. var widgetMissing = ( typeof config . widget === 'undefined' && typeof config [ 'widget' ] === 'undefined' ) ; var widget = true ; if ( ! widgetMissing ) { widget = config . widget || config [ 'widget' ] ; } var newConfig = /** @type {componentHandler.ComponentConfig} */ ( { classConstructor : config . constructor || config [ 'constructor' ] , className : config . classAsString || config [ 'classAsString' ] , cssClass : config . cssClass || config [ 'cssClass' ] , widget : widget , callbacks : [ ] } ) ; registeredComponents_ . forEach ( function ( item ) { if ( item . cssClass === newConfig . cssClass ) { throw new Error ( 'The provided cssClass has already been registered: ' + item . cssClass ) ; } if ( item . className === newConfig . className ) { throw new Error ( 'The provided className has already been registered' ) ; } } ) ; if ( config . constructor . prototype . hasOwnProperty ( componentConfigProperty_ ) ) { throw new Error ( 'MDL component classes must not have ' + componentConfigProperty_ + ' defined as a property.' ) ; } var found = findRegisteredClass_ ( config . classAsString , newConfig ) ; if ( ! found ) { registeredComponents_ . push ( newConfig ) ; } }
Registers a class for future use and attempts to upgrade existing DOM.

@param {componentHandler.ComponentConfigPublic} config
Registers a class for future use and attempts to upgrade existing DOM .