1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-09-15 07:22:28 +02:00

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.
This commit is contained in:
Raymond Hill 2020-05-19 10:29:09 -04:00
parent e9f9b5f622
commit 5229e0c810
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2

View File

@ -94,16 +94,9 @@ DOMListFactory.nodeFromSelector = function(selector) {
{ {
const root = DOMListFactory.root = document.querySelector(':root'); const root = DOMListFactory.root = document.querySelector(':root');
if ( if ( vAPI.webextFlavor.soup.has('mobile') ) {
window.matchMedia('(pointer: coarse)').matches ||
window.matchMedia('(hover: none)').matches
) {
root.classList.add('mobile'); root.classList.add('mobile');
} } else {
if (
window.matchMedia('(pointer: fine)').matches &&
window.matchMedia('(hover: hover)').matches
) {
root.classList.add('desktop'); root.classList.add('desktop');
} }
if ( window.matchMedia('(min-resolution: 150dpi)').matches ) { if ( window.matchMedia('(min-resolution: 150dpi)').matches ) {