mirror of
https://github.com/google/material-design-lite.git
synced 2024-09-19 08:07:24 +03:00
🆕 Textfield checkfocus
This commit is contained in:
parent
3c685b486c
commit
3c1f58d992
@ -117,6 +117,7 @@
|
||||
this.checkDisabled();
|
||||
this.checkValidity();
|
||||
this.checkDirty();
|
||||
this.checkFocus();
|
||||
};
|
||||
|
||||
// Public methods.
|
||||
@ -168,6 +169,21 @@
|
||||
MaterialTextfield.prototype['checkDirty'] =
|
||||
MaterialTextfield.prototype.checkDirty;
|
||||
|
||||
/**
|
||||
* Check the focus state and update field accordingly.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
MaterialTextfield.prototype.checkFocus = function() {
|
||||
if (Boolean(this.element_.querySelector(':focus'))) {
|
||||
this.element_.classList.add(this.CssClasses_.IS_FOCUSED);
|
||||
} else {
|
||||
this.element_.classList.remove(this.CssClasses_.IS_FOCUSED);
|
||||
}
|
||||
};
|
||||
MaterialTextfield.prototype['checkFocus'] =
|
||||
MaterialTextfield.prototype.checkFocus;
|
||||
|
||||
/**
|
||||
* Disable text field.
|
||||
*
|
||||
|
@ -59,6 +59,7 @@ describe('MaterialTextfield', function () {
|
||||
'checkDisabled',
|
||||
'checkValidity',
|
||||
'checkDirty',
|
||||
'checkFocus',
|
||||
'disable',
|
||||
'enable',
|
||||
'change'
|
||||
|
Loading…
Reference in New Issue
Block a user