🆕 Textfield checkfocus

This commit is contained in:
Jonathan Garbee 2015-12-04 06:34:24 -05:00
parent 3c685b486c
commit 3c1f58d992
2 changed files with 17 additions and 0 deletions

View File

@ -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.
*

View File

@ -59,6 +59,7 @@ describe('MaterialTextfield', function () {
'checkDisabled',
'checkValidity',
'checkDirty',
'checkFocus',
'disable',
'enable',
'change'