remove classList toggle with 2nd argument for IE11

This commit is contained in:
juliandescottes 2017-02-11 16:51:27 +01:00
parent 099ff80155
commit c68b82339c
2 changed files with 19 additions and 3 deletions

View File

@ -38,7 +38,11 @@
var isWarningDisplayed = this.performanceLinkEl.classList.contains('visible'); var isWarningDisplayed = this.performanceLinkEl.classList.contains('visible');
// Show/hide the performance warning link depending on the received report. // 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 // Show a notification message if the new report indicates a performance issue
// and we were not displaying a warning before. // and we were not displaying a warning before.

View File

@ -124,7 +124,13 @@
if (this.previewSizes.hasOwnProperty(size)) { if (this.previewSizes.hasOwnProperty(size)) {
var previewSize = this.previewSizes[size]; var previewSize = this.previewSizes[size];
var isSizeEnabled = validSizes.indexOf(size) != -1; 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 () { ns.PreviewController.prototype.updateOnionSkinPreview_ = function () {
var enabledClassname = 'preview-toggle-onion-skin-enabled'; var enabledClassname = 'preview-toggle-onion-skin-enabled';
var isEnabled = pskl.UserSettings.get(pskl.UserSettings.ONION_SKIN); 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 () { ns.PreviewController.prototype.selectPreviewSizeButton_ = function () {