Make detection of mobile navigations more readable
authorJoshua Rüsweg <josh@bastelstu.be>
Mon, 6 Aug 2018 14:19:46 +0000 (16:19 +0200)
committerJoshua Rüsweg <josh@bastelstu.be>
Mon, 6 Aug 2018 14:19:46 +0000 (16:19 +0200)
See #2508

wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Reaction/Handler.js

index 62ab004788e2c1c7dfb655b5a41162be06daa452..bf322088a8afb1b9fa0031ccd124f0bfd7af6a8b 100644 (file)
@@ -109,7 +109,7 @@ define(
                                        return; 
                                }
                                
-                               if (elementData.reactButton.parentElement.parentElement.classList.contains('jsMobileNavigation')) {
+                               if (elementData.reactButton.closest('.messageFooterGroup > .jsMobileNavigation')) {
                                        UiScreen.on('screen-sm-down', {
                                                match: this._enableMobileView.bind(this, elementData.reactButton, elementData.objectId),
                                                unmatch: this._disableMobileView.bind(this, elementData.reactButton, elementData.objectId),
@@ -161,7 +161,7 @@ define(
                        },
                        
                        _rebuildMobileView: function(objectID) {
-                               if (this._containers.get(objectID).reactButton.parentElement.parentElement.classList.contains('jsMobileNavigation')) {
+                               if (this._containers.get(objectID).reactButton.closest('.messageFooterGroup > .jsMobileNavigation')) {
                                        var messageFooterGroup = this._containers.get(objectID).reactButton.parentElement.parentElement.parentElement;
                                        var button = elBySel('.mobileReactButton', messageFooterGroup);