From 8149db843684f097c35bbcfe548a6f4fc92c1825 Mon Sep 17 00:00:00 2001 From: Leonard Date: Sat, 27 Oct 2018 17:26:52 +0200 Subject: [PATCH] Make it work in Internet Explorer (#434) + IE does not support multiple-parameter classList.add() / classList.remove(); Replace it with single-parameter calls https://caniuse.com/#feat=classlist + IE needs polyfills for Array.prototype.find / Array.prototype.includes --- src/scripts/components/wrapped-element.js | 12 ++++-------- src/scripts/lib/polyfills.js | 2 ++ 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/scripts/components/wrapped-element.js b/src/scripts/components/wrapped-element.js index 1b8d132..67e477b 100644 --- a/src/scripts/components/wrapped-element.js +++ b/src/scripts/components/wrapped-element.js @@ -17,10 +17,8 @@ export default class WrappedElement { conceal() { // Hide passed input - this.element.classList.add( - this.classNames.input, - this.classNames.hiddenState, - ); + this.element.classList.add(this.classNames.input); + this.element.classList.add(this.classNames.hiddenState); // Remove element from tab index this.element.tabIndex = '-1'; @@ -38,10 +36,8 @@ export default class WrappedElement { reveal() { // Reinstate passed element - this.element.classList.remove( - this.classNames.input, - this.classNames.hiddenState, - ); + this.element.classList.remove(this.classNames.input); + this.element.classList.remove(this.classNames.hiddenState); this.element.removeAttribute('tabindex'); // Recover original styles if any diff --git a/src/scripts/lib/polyfills.js b/src/scripts/lib/polyfills.js index cd0749d..8c01668 100644 --- a/src/scripts/lib/polyfills.js +++ b/src/scripts/lib/polyfills.js @@ -1,2 +1,4 @@ +import 'core-js/fn/array/find'; import 'core-js/fn/array/from'; +import 'core-js/fn/array/includes'; import 'custom-event-polyfill';