From: Alexander Ebert Date: Sun, 18 Dec 2016 16:23:38 +0000 (+0100) Subject: Work-around for Microsoft Edge's MQL behavior X-Git-Tag: 3.0.0_RC_2~29 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=9e9c787d0e8f1724e564470194d233d6679f9978;p=GitHub%2FWoltLab%2FWCF.git Work-around for Microsoft Edge's MQL behavior --- diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Screen.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Screen.js index dfdc3cd870..cef32a5872 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Screen.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Screen.js @@ -27,6 +27,10 @@ define(['Core', 'Dictionary', 'Environment'], function(Core, Dictionary, Environ 'screen-lg': '(min-width: 1025px)' /* desktop */ }); + // Microsoft Edge rewrites the media queries to whatever it + // pleases, causing the input and output query to mismatch + var _mqMapEdge = new Dictionary(); + /** * @exports WoltLabSuite/Core/Ui/Screen */ @@ -179,6 +183,10 @@ define(['Core', 'Dictionary', 'Environment'], function(Core, Dictionary, Environ throw new TypeError("Expected a non-empty string for parameter 'query'."); } + // Microsoft Edge rewrites the media queries to whatever it + // pleases, causing the input and output query to mismatch + if (_mqMapEdge.has(query)) query = _mqMapEdge.get(query); + if (_mqMap.has(query)) query = _mqMap.get(query); var queryObject = _mql.get(query); @@ -192,6 +200,10 @@ define(['Core', 'Dictionary', 'Environment'], function(Core, Dictionary, Environ queryObject.mql.addListener(this._mqlChange.bind(this)); _mql.set(query, queryObject); + + if (query !== queryObject.mql.media) { + _mqMapEdge.set(queryObject.mql.media, query); + } } return queryObject;