1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

Handle source properly in fillImage

This commit is contained in:
MrTimscampi 2020-04-12 14:34:51 +02:00
parent 58d9037986
commit e256e64e68

View file

@ -20,10 +20,11 @@ import 'css!./style';
throw new Error('entry cannot be null'); throw new Error('entry cannot be null');
} }
var source = undefined;
if (entry.target) { if (entry.target) {
var source = entry.target.getAttribute('data-src'); source = entry.target.getAttribute('data-src');
} else { } else {
var source = entry; source = entry;
} }
if (entry.intersectionRatio > 0 && source) { if (entry.intersectionRatio > 0 && source) {
@ -34,6 +35,10 @@ import 'css!./style';
} }
function fillImageElement(elem, url) { function fillImageElement(elem, url) {
if (url === undefined) {
throw new Error('url cannot be undefined');
}
let preloaderImg = new Image(); let preloaderImg = new Image();
preloaderImg.src = url; preloaderImg.src = url;