attachElement(element, index) {
    this.addEventListener(element, this.inputInfo.changeEvent, () => {
      // Delay update slightly to give input mask a chance to run.
      const textCase = _.get(this.component, 'case', 'mixed');

      if (textCase !== 'mixed') {
        const {
          selectionStart,
          selectionEnd,
        } = element;

        if (textCase === 'uppercase' && element.value) {
          element.value = element.value.toUpperCase();
        }
        if (textCase === 'lowercase' && element.value) {
          element.value = element.value.toLowerCase();
        }

        if (element.selectionStart && element.selectionEnd) {
          element.selectionStart = selectionStart;
          element.selectionEnd = selectionEnd;
        }
      }

      try {
        this.saveCaretPosition(element, index);
      }
      catch (err) {
        console.warn(this.t('caretPositionSavingError'), err);
      }

      // If a mask is present, delay the update to allow mask to update first.
      if (element.mask) {
        setTimeout(() => {
          return this.updateValue(null, {
            modified: (this.component.type !== 'hidden')
          }, index);
        }, 1);
      }
      else {
        return this.updateValue(null, {
          modified: (this.component.type !== 'hidden')
        }, index);
      }
    });

    if (!this.attachMultiMask(index)) {
      const applyMask = () => {
        this.setInputMask(element);

        const valueMask = this.component.inputMask;
        const displayMask = this.component.displayMask;

        if (valueMask && displayMask && displayMask !== valueMask && this.refs.valueMaskInput) {
          this.setInputMask(this.refs.valueMaskInput, valueMask);
        }
      };

      if (this.inputInfo.changeEvent === 'blur') {
        this.addEventListener(element, this.inputInfo.changeEvent, () => {
          applyMask();
          this.dataValue = this.refs.input[0].value;
          if (this.checkComponentValidity()) {
            this.updateComponentValue(this.refs.input[0].value);
          }
        });
      }
      else {
        applyMask();
      }
    }
  }
Attach inputs to the element.
@param {HTMLElement} element - The element to attach.
@param {number} index - The index of the element to attach.