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
This commit is contained in:
Leonard 2018-10-27 17:26:52 +02:00 committed by Josh Johnson
parent 15082ccd03
commit 8149db8436
2 changed files with 6 additions and 8 deletions

View file

@ -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

View file

@ -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';