Skip to content

Commit

Permalink
Revert "Add componentHanderConfig to config auto upgrade"
Browse files Browse the repository at this point in the history
This reverts commit 07bd6fd.
  • Loading branch information
AlexanderOtavka committed Sep 23, 2016
1 parent 93304a8 commit 2666977
Showing 1 changed file with 2 additions and 31 deletions.
33 changes: 2 additions & 31 deletions src/mdlComponentHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,6 @@
// Pre-defining the componentHandler interface, for closure documentation and
// static verification.
var componentHandler = {
/**
* Configuration for component handler, such as preventing initial upgrade.
*
* @type {componentHandler.ComponentHanderConfig}
*/
config: {},
/**
* Searches existing DOM for elements of our component type and upgrades them
* if they have not already been upgraded.
Expand Down Expand Up @@ -99,15 +93,6 @@ componentHandler = (function() {

var componentConfigProperty_ = 'mdlComponentConfigInternal_';

var configInternal = {
preventAutoUpgrade: false
};

var globalConfig_ = window.componentHandlerConfig || {};
if ('preventAutoUpgrade' in globalConfig_) {
configInternal.preventAutoUpgrade = globalConfig_.preventAutoUpgrade;
}

/**
* Searches registered components for a class we are interested in using.
* Optionally replaces a match with passed object if specified.
Expand Down Expand Up @@ -412,10 +397,9 @@ componentHandler = (function() {
}
}

// Now return the functions and members that should be made public with their publicly
// Now return the functions that should be made public with their publicly
// facing names...
return {
config: configInternal,
upgradeDom: upgradeDomInternal,
upgradeElement: upgradeElementInternal,
upgradeElements: upgradeElementsInternal,
Expand All @@ -426,16 +410,6 @@ componentHandler = (function() {
};
})();

/**
* Describes the type of the config object for componentHandler.
* Provided for benefit of the Closure compiler.
*
* @typedef {{
* preventAutoUpgrade: boolean
* }}
*/
componentHandler.ComponentHandlerConfig; // jshint ignore: line

/**
* Describes the type of a registered component type managed by
* componentHandler. Provided for benefit of the Closure compiler.
Expand Down Expand Up @@ -479,7 +453,6 @@ componentHandler.Component; // jshint ignore:line

// Export all symbols, for the benefit of Closure compiler.
// No effect on uncompiled code.
componentHandler['config'] = componentHandler.config;
componentHandler['upgradeDom'] = componentHandler.upgradeDom;
componentHandler['upgradeElement'] = componentHandler.upgradeElement;
componentHandler['upgradeElements'] = componentHandler.upgradeElements;
Expand All @@ -504,9 +477,7 @@ window.addEventListener('load', function() {
'querySelector' in document &&
'addEventListener' in window && Array.prototype.forEach) {
document.documentElement.classList.add('mdl-js');
if (!componentHandler.config.preventAutoUpgrade) {
componentHandler.upgradeAllRegistered();
}
componentHandler.upgradeAllRegistered();
} else {
/**
* Dummy function to avoid JS errors.
Expand Down

0 comments on commit 2666977

Please sign in to comment.