|
19 | 19 | if (el.id) break; |
20 | 20 | node = el.parentNode; |
21 | 21 | } |
22 | | - } catch (err) {} |
| 22 | + } catch {} |
23 | 23 | return sel; |
24 | 24 | } |
25 | 25 |
|
|
54 | 54 | if (entry && entry.transferSize) { |
55 | 55 | return (entry.transferSize / 1024).toFixed(1) + " KB"; |
56 | 56 | } |
57 | | - } catch (err) {} |
| 57 | + } catch {} |
58 | 58 | return null; |
59 | 59 | } |
60 | 60 |
|
|
189 | 189 |
|
190 | 190 | // Table of all problematic images |
191 | 191 | console.group("📋 Lazy Loaded Images in Viewport"); |
192 | | - const tableData = results.lazyImages.map(({ element, area, position, ...rest }) => ({ |
193 | | - ...rest, |
194 | | - top: position.top + "px", |
195 | | - isLcpCandidate: rest.isLcpCandidate ? "⚠️ YES" : "no" |
| 192 | + const tableData = results.lazyImages.map((image) => ({ |
| 193 | + selector: image.selector, |
| 194 | + lazyType: image.lazyType, |
| 195 | + dimensions: image.dimensions, |
| 196 | + top: image.position.top + "px", |
| 197 | + distanceFromEdge: image.distanceFromEdge, |
| 198 | + src: image.src, |
| 199 | + srcset: image.srcset, |
| 200 | + sizes: image.sizes, |
| 201 | + alt: image.alt, |
| 202 | + fetchPriority: image.fetchPriority, |
| 203 | + fileSize: image.fileSize, |
| 204 | + isLcpCandidate: image.isLcpCandidate ? "⚠️ YES" : "no", |
196 | 205 | })); |
197 | 206 | console.table(tableData); |
198 | 207 | console.groupEnd(); |
|
233 | 242 | withDataSrc: results.summary.withDataSrc, |
234 | 243 | lcpAffected: results.summary.lcpAffected, |
235 | 244 | }, |
236 | | - items: results.lazyImages.map(({ element, area, ...rest }) => rest), |
| 245 | + items: results.lazyImages.map((image) => ({ |
| 246 | + selector: image.selector, |
| 247 | + lazyType: image.lazyType, |
| 248 | + dimensions: image.dimensions, |
| 249 | + position: image.position, |
| 250 | + distanceFromEdge: image.distanceFromEdge, |
| 251 | + src: image.src, |
| 252 | + srcset: image.srcset, |
| 253 | + sizes: image.sizes, |
| 254 | + alt: image.alt, |
| 255 | + fetchPriority: image.fetchPriority, |
| 256 | + fileSize: image.fileSize, |
| 257 | + isLcpCandidate: image.isLcpCandidate, |
| 258 | + })), |
237 | 259 | issues: [ |
238 | 260 | ...(results.summary.lcpAffected ? [{ severity: "error", message: 'LCP candidate image has lazy loading — remove loading="lazy" and add fetchpriority="high"' }] : []), |
239 | 261 | ...(results.lazyImages.filter(i => !i.isLcpCandidate).length > 0 ? [{ severity: "warning", message: `${results.lazyImages.filter(i => !i.isLcpCandidate).length} above-fold image(s) have lazy loading — remove loading="lazy"` }] : []), |
|
0 commit comments