1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-11-24 03:12:46 +01:00

blocked-image-by-size: getComputedStyle() on Pale Moon can return null

This commit is contained in:
gorhill 2016-01-23 16:57:20 -05:00
parent 7a0b4356ad
commit 58838ce4c5

View File

@ -52,11 +52,14 @@ var mediaNotLoaded = function(elem) {
case 'video':
return elem.error !== null;
case 'img':
if ( elem.naturalWidth === 0 && elem.naturalHeight === 0 ) {
return window.getComputedStyle(elem)
.getPropertyValue('display') !== 'none';
if ( elem.naturalWidth !== 0 || elem.naturalHeight !== 0 ) {
break;
}
break;
var style = window.getComputedStyle(elem);
// For some reason, style can be null with Pale Moon.
return style !== null ?
style.getPropertyValue('display') !== 'none' :
elem.offsetHeight !== 0 && elem.offsetWidth !== 0;
default:
break;
}