Skip to content

Look for fetchPriority instead of importance #103

@fariasf

Description

@fariasf

In https://github.com/sitespeedio/coach-core/blob/aa2654879533af3ec0381acaf9e7f0b1bfe84c30/lib/dom/performance/largestContentfulPaint.js#L44C1-L49 The Coach will take 5 points if the LCP element is an img and it misses the importance="high" attribute.

According to https://web.dev/fetch-priority/#history, this attribute is now fetchPriority:

Fetch Priority was first experimented with in Chrome as an origin trial in 2018 and then again in 2021 using the importance attribute. At that time it was known as Priority Hints. The interface has since changed to fetchpriority for HTML and priority for JavaScript's Fetch API as part of the web standards process. To reduce confusion we now refer to this API as Fetch Priority.

I've tried adding both attributes to get a perfect score there, but I think doesn't work in recent versions of Chrome as it already moved to fetchPriority (testing manually in the JS console, markup for lcp_image is <img importance="high" fetchpriority="high" src=...):

lcp_image.importance
undefined
lcp_image.fetchPriority
'high'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions