From 906c2897ca9e4aecc0a7b20d6724a0b05768e3d5 Mon Sep 17 00:00:00 2001 From: "Seul-gi Choi(Chase)" Date: Wed, 17 Jul 2019 17:19:21 +0900 Subject: [PATCH] fix class toggling on control for IE (#8495) * fix class toggling on control for IE The second argument of `classList.toggle` is not supported in IE. So, the control displays as disabled in IE at default. https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/11865865/ * fix the operator for lint change the ternary operator to if~else condition to pass lint. --- src/ui/control/navigation_control.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/ui/control/navigation_control.js b/src/ui/control/navigation_control.js index b0e10a996fe..bdd2333921a 100644 --- a/src/ui/control/navigation_control.js +++ b/src/ui/control/navigation_control.js @@ -72,8 +72,16 @@ class NavigationControl { _updateZoomButtons() { const zoom = this._map.getZoom(); - this._zoomInButton.classList.toggle('mapboxgl-ctrl-icon-disabled', zoom === this._map.getMaxZoom()); - this._zoomOutButton.classList.toggle('mapboxgl-ctrl-icon-disabled', zoom === this._map.getMinZoom()); + if (zoom === this._map.getMaxZoom()) { + this._zoomInButton.classList.add('mapboxgl-ctrl-icon-disabled'); + } else { + this._zoomInButton.classList.remove('mapboxgl-ctrl-icon-disabled'); + } + if (zoom === this._map.getMinZoom()) { + this._zoomOutButton.classList.add('mapboxgl-ctrl-icon-disabled'); + } else { + this._zoomOutButton.classList.remove('mapboxgl-ctrl-icon-disabled'); + } } _rotateCompassArrow() {