// Recalculate image size if parent is document.addEventListener('lazybeforesizes', (e) => { // for some reason sometimes e.detail is undefined, so we need to check it. if (!e.detail || !e.detail.width || !e.target) { return; } const parent = e.target.closest(':not(picture)'); if (parent) { e.detail.width = parent.clientWidth || e.detail.width; } }); /** * Remove