From c68b82339ce170fe67408d8d2343cab4c7a264b6 Mon Sep 17 00:00:00 2001 From: juliandescottes Date: Sat, 11 Feb 2017 16:51:27 +0100 Subject: [PATCH] remove classList toggle with 2nd argument for IE11 --- src/js/controller/UserWarningController.js | 6 +++++- src/js/controller/preview/PreviewController.js | 16 ++++++++++++++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/js/controller/UserWarningController.js b/src/js/controller/UserWarningController.js index c1b62147..423a372f 100644 --- a/src/js/controller/UserWarningController.js +++ b/src/js/controller/UserWarningController.js @@ -38,7 +38,11 @@ var isWarningDisplayed = this.performanceLinkEl.classList.contains('visible'); // Show/hide the performance warning link depending on the received report. - this.performanceLinkEl.classList.toggle('visible', shouldDisplayWarning); + if (shouldDisplayWarning) { + this.performanceLinkEl.classList.add('visible'); + } else { + this.performanceLinkEl.classList.remove('visible'); + } // Show a notification message if the new report indicates a performance issue // and we were not displaying a warning before. diff --git a/src/js/controller/preview/PreviewController.js b/src/js/controller/preview/PreviewController.js index ee624436..a7bb7dfc 100644 --- a/src/js/controller/preview/PreviewController.js +++ b/src/js/controller/preview/PreviewController.js @@ -124,7 +124,13 @@ if (this.previewSizes.hasOwnProperty(size)) { var previewSize = this.previewSizes[size]; var isSizeEnabled = validSizes.indexOf(size) != -1; - previewSize.button.classList.toggle('preview-contextual-action-hidden', !isSizeEnabled); + + // classList.toggle is not available on IE11. + if (isSizeEnabled) { + previewSize.button.classList.remove('preview-contextual-action-hidden'); + } else { + previewSize.button.classList.add('preview-contextual-action-hidden'); + } } } @@ -174,7 +180,13 @@ ns.PreviewController.prototype.updateOnionSkinPreview_ = function () { var enabledClassname = 'preview-toggle-onion-skin-enabled'; var isEnabled = pskl.UserSettings.get(pskl.UserSettings.ONION_SKIN); - this.toggleOnionSkinButton.classList.toggle(enabledClassname, isEnabled); + + // classList.toggle is not available on IE11. + if (isEnabled) { + this.toggleOnionSkinButton.classList.add(enabledClassname); + } else { + this.toggleOnionSkinButton.classList.remove(enabledClassname); + } }; ns.PreviewController.prototype.selectPreviewSizeButton_ = function () {