Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
constructor(...args) {
super(...args);
this.$element.addClass(MDCTextFieldFoundation.cssClasses.ROOT);
this.root_ = this.$element[0];
this.setupInput_();
}
setupDense_() {
this.$element.toggleClass(MDCTextFieldFoundation.cssClasses.DENSE, !this.isTextArea && Boolean(this.dense));
}
setupOutlinedAndBox_() {
const outlineElement = this.root_.getElementsByClassName('mdc-text-field__outline')[0];
const idleOutlineElement = this.root_.getElementsByClassName('mdc-text-field__idle-outline')[0];
const bottomLineElement = this.root_.getElementsByClassName('mdc-line-ripple')[0];
this.$element.toggleClass(MDCTextFieldFoundation.cssClasses.OUTLINED, Boolean(this.outlined) && !this.isTextArea);
this.$element.toggleClass(MDCTextFieldFoundation.cssClasses.BOX, !Boolean(this.outlined) && Boolean(this.box));
const wantsOutline = this.outlined && !this.isTextArea;
const wantsBottomLine = !this.outlined && !this.isTextArea;
if (wantsOutline && !outlineElement) {
if (!outlineElement) {
this.$element.append(outlineTemplate);
}
} else if (!wantsOutline) {
if (outlineElement) {
outlineElement.remove();
}
if (idleOutlineElement) {
idleOutlineElement.remove();
}
}