mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-07 03:12:33 +01:00
Fix merging multiple URls in element picker
Related discussion: - https://www.reddit.com/r/uBlockOrigin/comments/c5do7w/ Fixed: - Expect the differ can return the first input as is when there is no difference between the two items. - Better deal with extraneous whitespaces in `srcset`
This commit is contained in:
parent
9065bbdd48
commit
d1df2b5e73
@ -296,7 +296,7 @@ const mergeStrings = function(urls) {
|
||||
if ( diff[0] !== 0 ) {
|
||||
result.push('*');
|
||||
} else {
|
||||
result.push(diff[1].charAt(0));
|
||||
result.push(diff[1].replace(/\n+/g, ''));
|
||||
}
|
||||
}
|
||||
// Keep usage of wildcards to a sane level, too many of them can cause
|
||||
@ -343,6 +343,7 @@ const resourceURLFromElement = function(elem) {
|
||||
if ( typeof elem.srcset === 'string' && elem.srcset !== '' ) {
|
||||
const ss = [];
|
||||
for ( let s of elem.srcset.split(',') ) {
|
||||
s = s.trim();
|
||||
const pos = s.indexOf(' ');
|
||||
if ( pos !== -1 ) { s = s.slice(0, pos); }
|
||||
const parsedURL = new URL(s, document.baseURI);
|
||||
|
Loading…
Reference in New Issue
Block a user