Skip to content

Account for preload links with fetchpriority=high in analyze-loading-optimization #144

Open
@westonruter

Description

The analyze-loading-optimization command doesn't currently account for fetchpriority=high being added for images via preload links:

// Obtain fetchPriorityCount, lcpImageMissingFetchPriority, fetchPriorityInsideViewport, and fetchPriorityOutsideViewport.
const fetchpriorityHighImages = document.body.querySelectorAll(
'img[fetchpriority="high"]'
);
for ( const img of fetchpriorityHighImages ) {
analysis.fetchPriorityCount++;
if ( isElementInViewport( img ) ) {
analysis.fetchPriorityInsideViewport++;
} else {
analysis.fetchPriorityOutsideViewport++;
}
}

This is done by the Image Prioritizer plugin especially when the same image is not LCP on mobile and desktop, as in this case adding fetchpriority=high could be incorrect for one or the other.

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions