From da133747eb6bd672572a6fb177726bc3755b8258 Mon Sep 17 00:00:00 2001 From: Josh Johnson Date: Fri, 6 Oct 2017 09:37:17 +0100 Subject: [PATCH] Revert "Begin to abstract passedElement code" This reverts commit 55fca5d402bbc696cbda53040076b1acabda7170. --- src/scripts/src/components/wrapped-element.js | 38 ------------------- 1 file changed, 38 deletions(-) delete mode 100644 src/scripts/src/components/wrapped-element.js diff --git a/src/scripts/src/components/wrapped-element.js b/src/scripts/src/components/wrapped-element.js deleted file mode 100644 index cdadf6a..0000000 --- a/src/scripts/src/components/wrapped-element.js +++ /dev/null @@ -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'); - } -}