Don't call private component methods from the component handler.

This creates a public alias for every private downgrade method,
and switches the component handler to using the aliases instead.
master
Sérgio Gomes 2015-10-28 14:48:09 +00:00
parent f27340dc47
commit b2c7346a44
11 changed files with 111 additions and 1 deletions

View File

@ -125,6 +125,17 @@
this.element_.removeEventListener('mouseleave', this.boundButtonBlurHandler);
};
/**
* Public alias for the downgrade method.
*
* @public
*/
MaterialButton.prototype.mdlDowngrade =
MaterialButton.prototype.mdlDowngrade_;
MaterialButton.prototype['mdlDowngrade'] =
MaterialButton.prototype.mdlDowngrade;
// The component registers itself. It can assume componentHandler is available
// in the global scope.
componentHandler.register({

View File

@ -273,6 +273,17 @@
this.element_.removeEventListener('mouseup', this.boundElementMouseUp);
};
/**
* Public alias for the downgrade method.
*
* @public
*/
MaterialCheckbox.prototype.mdlDowngrade =
MaterialCheckbox.prototype.mdlDowngrade_;
MaterialCheckbox.prototype['mdlDowngrade'] =
MaterialCheckbox.prototype.mdlDowngrade;
// The component registers itself. It can assume componentHandler is available
// in the global scope.
componentHandler.register({

View File

@ -259,6 +259,17 @@
this.element_.removeEventListener('mouseup', this.boundElementOnMouseUp);
};
/**
* Public alias for the downgrade method.
*
* @public
*/
MaterialIconToggle.prototype.mdlDowngrade =
MaterialIconToggle.prototype.mdlDowngrade_;
MaterialIconToggle.prototype['mdlDowngrade'] =
MaterialIconToggle.prototype.mdlDowngrade;
// The component registers itself. It can assume componentHandler is available
// in the global scope.
componentHandler.register({

View File

@ -91,7 +91,7 @@ componentHandler = (function() {
/** @type {!Array<componentHandler.Component>} */
var createdComponents_ = [];
var downgradeMethod_ = 'mdlDowngrade_';
var downgradeMethod_ = 'mdlDowngrade';
var componentConfigProperty_ = 'mdlComponentConfigInternal_';
/**

View File

@ -480,6 +480,17 @@
}
};
/**
* Public alias for the downgrade method.
*
* @public
*/
MaterialMenu.prototype.mdlDowngrade =
MaterialMenu.prototype.mdlDowngrade_;
MaterialMenu.prototype['mdlDowngrade'] =
MaterialMenu.prototype.mdlDowngrade;
// The component registers itself. It can assume componentHandler is available
// in the global scope.
componentHandler.register({

View File

@ -123,6 +123,17 @@
}
};
/**
* Public alias for the downgrade method.
*
* @public
*/
MaterialProgress.prototype.mdlDowngrade =
MaterialProgress.prototype.mdlDowngrade_;
MaterialProgress.prototype['mdlDowngrade'] =
MaterialProgress.prototype.mdlDowngrade;
// The component registers itself. It can assume componentHandler is available
// in the global scope.
componentHandler.register({

View File

@ -267,6 +267,17 @@
this.element_.removeEventListener('blur', this.boundUpHandler);
};
/**
* Public alias for the downgrade method.
*
* @public
*/
MaterialRipple.prototype.mdlDowngrade =
MaterialRipple.prototype.mdlDowngrade_;
MaterialRipple.prototype['mdlDowngrade'] =
MaterialRipple.prototype.mdlDowngrade;
// The component registers itself. It can assume componentHandler is available
// in the global scope.
componentHandler.register({

View File

@ -245,6 +245,17 @@
this.element_.parentElement.removeEventListener('mousedown', this.boundContainerMouseDownHandler);
};
/**
* Public alias for the downgrade method.
*
* @public
*/
MaterialSlider.prototype.mdlDowngrade =
MaterialSlider.prototype.mdlDowngrade_;
MaterialSlider.prototype['mdlDowngrade'] =
MaterialSlider.prototype.mdlDowngrade;
// The component registers itself. It can assume componentHandler is available
// in the global scope.
componentHandler.register({

View File

@ -277,6 +277,17 @@
this.element_.removeEventListener('mouseup', this.boundMouseUpHandler);
};
/**
* Public alias for the downgrade method.
*
* @public
*/
MaterialSwitch.prototype.mdlDowngrade =
MaterialSwitch.prototype.mdlDowngrade_;
MaterialSwitch.prototype['mdlDowngrade'] =
MaterialSwitch.prototype.mdlDowngrade;
// The component registers itself. It can assume componentHandler is available
// in the global scope.
componentHandler.register({

View File

@ -250,6 +250,17 @@
}
};
/**
* Public alias for the downgrade method.
*
* @public
*/
MaterialTextfield.prototype.mdlDowngrade =
MaterialTextfield.prototype.mdlDowngrade_;
MaterialTextfield.prototype['mdlDowngrade'] =
MaterialTextfield.prototype.mdlDowngrade;
// The component registers itself. It can assume componentHandler is available
// in the global scope.
componentHandler.register({

View File

@ -141,6 +141,17 @@
}
};
/**
* Public alias for the downgrade method.
*
* @public
*/
MaterialTooltip.prototype.mdlDowngrade =
MaterialTooltip.prototype.mdlDowngrade_;
MaterialTooltip.prototype['mdlDowngrade'] =
MaterialTooltip.prototype.mdlDowngrade;
// The component registers itself. It can assume componentHandler is available
// in the global scope.
componentHandler.register({