mirror of
https://github.com/google/material-design-lite.git
synced 2024-09-11 12:25:38 +03:00
Merge pull request #1569 from andyyou/master
Add reset event of textfield
This commit is contained in:
commit
3d9b1cbab2
@ -98,6 +98,16 @@
|
||||
this.element_.classList.remove(this.CssClasses_.IS_FOCUSED);
|
||||
};
|
||||
|
||||
/**
|
||||
* Handle reset event from out side.
|
||||
*
|
||||
* @param {Event} event The event that fired.
|
||||
* @private
|
||||
*/
|
||||
MaterialTextfield.prototype.onReset_ = function(event) {
|
||||
this.updateClasses_();
|
||||
};
|
||||
|
||||
/**
|
||||
* Handle class updates.
|
||||
*
|
||||
@ -206,9 +216,11 @@
|
||||
this.boundUpdateClassesHandler = this.updateClasses_.bind(this);
|
||||
this.boundFocusHandler = this.onFocus_.bind(this);
|
||||
this.boundBlurHandler = this.onBlur_.bind(this);
|
||||
this.boundResetHandler = this.onReset_.bind(this);
|
||||
this.input_.addEventListener('input', this.boundUpdateClassesHandler);
|
||||
this.input_.addEventListener('focus', this.boundFocusHandler);
|
||||
this.input_.addEventListener('blur', this.boundBlurHandler);
|
||||
this.input_.addEventListener('reset', this.boundResetHandler);
|
||||
|
||||
if (this.maxRows !== this.Constant_.NO_MAX_ROWS) {
|
||||
// TODO: This should handle pasting multi line text.
|
||||
@ -232,6 +244,7 @@
|
||||
this.input_.removeEventListener('input', this.boundUpdateClassesHandler);
|
||||
this.input_.removeEventListener('focus', this.boundFocusHandler);
|
||||
this.input_.removeEventListener('blur', this.boundBlurHandler);
|
||||
this.input_.removeEventListener('reset', this.boundResetHandler);
|
||||
if (this.boundKeyDownHandler) {
|
||||
this.input_.removeEventListener('keydown', this.boundKeyDownHandler);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user