Fixing style nits (Closes #422)

master
Luke Mahe 2015-06-22 16:00:55 +10:00 committed by Addy Osmani
parent d74aab72be
commit ae50c0f8ee
1 changed files with 17 additions and 12 deletions

View File

@ -102,7 +102,7 @@ var componentHandler = (function() {
instance[componentConfigProperty_] = registeredClass;
createdComponents_.push(instance);
// Call any callbacks the user has registered with this component type.
registeredClass.callbacks.forEach(function (callback) {
registeredClass.callbacks.forEach(function(callback) {
callback(element);
});
@ -143,8 +143,10 @@ var componentHandler = (function() {
}
});
if (config.constructor.prototype.hasOwnProperty(componentConfigProperty_)) {
throw 'MDL component classes must not have ' + componentConfigProperty_ + ' defined as a property.';
if (config.constructor.prototype
.hasOwnProperty(componentConfigProperty_)) {
throw 'MDL component classes must not have ' + componentConfigProperty_ +
' defined as a property.';
}
var found = findRegisteredClass_(config.classAsString, newConfig);
@ -182,8 +184,8 @@ var componentHandler = (function() {
/**
* Finds a created component by a given DOM node.
*
* @param node
* @returns {*}
* @param {!Element} node
* @return {*}
*/
function findCreatedComponentByNodeInternal(node) {
for (var n = 0; n < createdComponents_.length; n++) {
@ -199,7 +201,7 @@ var componentHandler = (function() {
* Execute if found.
* Remove component from createdComponents list.
*
* @param component
* @param {*} component
*/
function deconstructComponentInternal(component) {
if (component &&
@ -209,10 +211,13 @@ var componentHandler = (function() {
component[downgradeMethod_]();
var componentIndex = createdComponents_.indexOf(component);
createdComponents_.splice(componentIndex, 1);
var upgrades = component.element_.dataset.upgraded.split(',');
var componentPlace = upgrades.indexOf(component[componentConfigProperty_].classAsString);
var componentPlace = upgrades.indexOf(
component[componentConfigProperty_].classAsString);
upgrades.splice(componentPlace, 1);
component.element_.dataset.upgraded = upgrades.join(',');
var ev = document.createEvent('Events');
ev.initEvent('mdl-componentdowngraded', true, true);
component.element_.dispatchEvent(ev);
@ -222,7 +227,7 @@ var componentHandler = (function() {
/**
* Downgrade either a given node, an array of nodes, or a NodeList.
*
* @param nodes
* @param {*} nodes
*/
function downgradeNodesInternal(nodes) {
var downgradeNode = function(node) {
@ -266,6 +271,6 @@ window.addEventListener('load', function() {
componentHandler.upgradeAllRegistered();
} else {
componentHandler.upgradeElement =
componentHandler.register = function () { };
componentHandler.register = function() {};
}
});