Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
this.helperTextElement_.textContent = this.helperText;
if (this.helperTextPersistent) {
this.helperTextElement_.classList.add(
MDCTextFieldHelperTextFoundation.cssClasses.HELPER_TEXT_PERSISTENT
);
} else {
this.helperTextElement_.classList.remove(
MDCTextFieldHelperTextFoundation.cssClasses.HELPER_TEXT_PERSISTENT
);
}
if (this.helperTextValidation) {
this.helperTextElement_.classList.add(
MDCTextFieldHelperTextFoundation.cssClasses.HELPER_TEXT_VALIDATION_MSG
);
} else {
this.helperTextElement_.classList.remove(
MDCTextFieldHelperTextFoundation.cssClasses.HELPER_TEXT_VALIDATION_MSG
);
}
} else if (!wantsHelpText && this.helperTextElement_) {
this.helperTextElement_.remove();
delete this.helperTextElement_;
this.inputElement_.removeAttribute('aria-controls');
}
}
if (wantsHelpText) {
if (!this.helperTextElement_) {
this.helperTextElement_ = this.$document[0].createElement('p');
this.helperTextElement_.className = 'mdc-text-field-helper-text';
this.helperTextElement_.id = `${this.inputElement_.id}--help`;
this.inputElement_.setAttribute('aria-controls', this.helperTextElement_.id);
this.root_.insertAdjacentElement('afterend', this.helperTextElement_);
}
this.helperTextElement_.textContent = this.helperText;
if (this.helperTextPersistent) {
this.helperTextElement_.classList.add(
MDCTextFieldHelperTextFoundation.cssClasses.HELPER_TEXT_PERSISTENT
);
} else {
this.helperTextElement_.classList.remove(
MDCTextFieldHelperTextFoundation.cssClasses.HELPER_TEXT_PERSISTENT
);
}
if (this.helperTextValidation) {
this.helperTextElement_.classList.add(
MDCTextFieldHelperTextFoundation.cssClasses.HELPER_TEXT_VALIDATION_MSG
);
} else {
this.helperTextElement_.classList.remove(
MDCTextFieldHelperTextFoundation.cssClasses.HELPER_TEXT_VALIDATION_MSG
);
}