mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-11 17:41:03 +01:00
this fixes #1258
This commit is contained in:
parent
bb27f33b35
commit
4bb9ef59ba
2 changed files with 13 additions and 9 deletions
|
@ -50,13 +50,14 @@ elems = document.querySelectorAll('img');
|
|||
i = elems.length;
|
||||
while ( i-- ) {
|
||||
elem = elems[i];
|
||||
if (
|
||||
typeof elem.naturalWidth !== 'number' ||
|
||||
elem.naturalWidth === 0 ||
|
||||
typeof elem.naturalHeight !== 'number' ||
|
||||
elem.naturalHeight === 0
|
||||
) {
|
||||
src = elem.getAttribute('src') || '';
|
||||
if ( elem.naturalWidth !== 0 && elem.naturalHeight !== 0 ) {
|
||||
continue;
|
||||
}
|
||||
if ( window.getComputedStyle(elem).getPropertyValue('display') === 'none' ) {
|
||||
continue;
|
||||
}
|
||||
src = elem.getAttribute('src');
|
||||
if ( src ) {
|
||||
elem.removeAttribute('src');
|
||||
elem.setAttribute('src', src);
|
||||
}
|
||||
|
|
|
@ -52,8 +52,11 @@ var mediaNotLoaded = function(elem) {
|
|||
case 'video':
|
||||
return elem.error !== null;
|
||||
case 'img':
|
||||
return elem.offsetWidth !== 0 && elem.offsetHeight !== 0 &&
|
||||
(elem.naturalWidth === 0 || elem.naturalHeight === 0);
|
||||
if ( elem.naturalWidth === 0 && elem.naturalHeight === 0 ) {
|
||||
return window.getComputedStyle(elem)
|
||||
.getPropertyValue('display') !== 'none';
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue