From 5229e0c81086fd7e89143511c540e64789b98aaa Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Tue, 19 May 2020 10:29:09 -0400 Subject: [PATCH] Ensure either `.desktop` or `.mobile` class is set One of these must always be present. This commit fixes a theoretical case where neither of these classes are set on the body element. --- src/js/udom.js | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/js/udom.js b/src/js/udom.js index 805d1dd77..268aec049 100644 --- a/src/js/udom.js +++ b/src/js/udom.js @@ -94,16 +94,9 @@ DOMListFactory.nodeFromSelector = function(selector) { { const root = DOMListFactory.root = document.querySelector(':root'); - if ( - window.matchMedia('(pointer: coarse)').matches || - window.matchMedia('(hover: none)').matches - ) { + if ( vAPI.webextFlavor.soup.has('mobile') ) { root.classList.add('mobile'); - } - if ( - window.matchMedia('(pointer: fine)').matches && - window.matchMedia('(hover: hover)').matches - ) { + } else { root.classList.add('desktop'); } if ( window.matchMedia('(min-resolution: 150dpi)').matches ) {