Revert "Begin to abstract passedElement code"

This reverts commit 55fca5d402.
This commit is contained in:
Josh Johnson 2017-10-06 09:37:17 +01:00
parent 55fca5d402
commit da133747eb

View file

@ -1,38 +0,0 @@
import { isType } from '../lib/utils';
export default class WrappedElement {
constructor(instance, element, classNames) {
this.instance = instance;
this.element = isType('String', element) ? document.querySelector(element) : element;
if (!this.element || !['text', 'select-one', 'select-multiple'].includes(this.element.type)) {
return false;
}
this.classNames = classNames;
this.type = this.element.type;
this.placeholder = this.element.getAttribute('placeholder');
}
hide() {
// Hide passed input
this.element.classList.add(
this.classNames.input,
this.classNames.hiddenState,
);
// Remove element from tab index
this.element.tabIndex = '-1';
// Backup original styles if any
const origStyle = this.element.getAttribute('style');
if (origStyle) {
this.element.setAttribute('data-choice-orig-style', origStyle);
}
this.element.setAttribute('style', 'display:none;');
this.element.setAttribute('aria-hidden', 'true');
this.element.setAttribute('data-choice', 'active');
}
}