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
1 changed files with 7 additions and 4 deletions

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;
}
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;
}