From 2cc6835de0e408ea7a9d87274ede3a8030531c1b Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Tue, 15 Nov 2022 09:44:19 -0500 Subject: [PATCH] Use placeholders to minimize vertical shifting at page load time Related issue: - https://github.com/uBlockOrigin/uBlock-issues/issues/2361 --- src/document-blocked.html | 16 ++++++++-------- src/js/document-blocked.js | 8 ++++++-- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/document-blocked.html b/src/document-blocked.html index ebc38ddf9..36c26444d 100644 --- a/src/document-blocked.html +++ b/src/document-blocked.html @@ -17,24 +17,24 @@
-

+

_

-

-

-
- +
diff --git a/src/js/document-blocked.js b/src/js/document-blocked.js index 7e91bdfa8..9e4f15cb7 100644 --- a/src/js/document-blocked.js +++ b/src/js/document-blocked.js @@ -53,9 +53,13 @@ let details = {}; } } - if ( Array.isArray(lists) === false || lists.length === 0 ) { return; } + if ( Array.isArray(lists) === false || lists.length === 0 ) { + qs$('#whyex').style.setProperty('visibility', 'collapse'); + return; + } const parent = qs$('#whyex > ul'); + parent.firstElementChild.remove(); // remove placeholder element for ( const list of lists ) { const listElem = dom.clone('#templates .filterList'); const sourceElem = qs$(listElem, '.filterListSource'); @@ -68,7 +72,7 @@ let details = {}; } parent.appendChild(listElem); } - qs$('#whyex').style.removeProperty('display'); + qs$('#whyex').style.removeProperty('visibility'); })(); /******************************************************************************/