1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-10-06 09:37:12 +02:00

Fix broken "Block element..." case when cosmetic filtering is off

Related feedback:
- e983f9a76e (commitcomment-53382148)
This commit is contained in:
Raymond Hill 2021-07-12 18:32:32 -04:00
parent b7047e04d0
commit 9a60573abe
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2

View File

@ -1052,9 +1052,11 @@ const startPicker = function() {
const elems = document.getElementsByTagName(tagName);
for ( const elem of elems ) {
if ( elem === pickerRoot ) { continue; }
const src = elem[attr];
if ( typeof src !== 'string' ) { continue; }
if ( (src !== url) && (src !== '' || url !== 'about:blank') ) {
const srcs = resourceURLsFromElement(elem);
if (
(srcs.length !== 0 && srcs.includes(url) === false) ||
(srcs.length === 0 && url !== 'about:blank')
) {
continue;
}
filtersFrom(elem);
@ -1062,7 +1064,13 @@ const startPicker = function() {
netFilterCandidates.length !== 0 ||
cosmeticFilterCandidates.length !== 0
) {
elem.scrollIntoView({ behavior: 'smooth', block: 'center' });
if ( pickerBootArgs.mouse !== true ) {
elem.scrollIntoView({
behavior: 'smooth',
block: 'center',
inline: 'center'
});
}
showDialog({ broad: true });
}
return;