[quesion-finished] Strange PerformanceObserver API Judgment of LCP Elements

refer: https://codepen.io/yilaikesi/pen/VwobPJV

There are two elements on my interface.

One is logo.svg, and the parsing time is 300ms.
The other is a 4K image, and the parsing time is 1000ms.

As expected, when both are on the page, the largest contentful paint (LCP) should always be that 4K image.

However, in reality,

when I place the 4K image before the logo image, then the LCP is the 4K image.

When I place the 4K image after the logo image, then the LCP is the logo image.

This is not expectations


As indicated in https://github.com/tc39/ecma262/issues/3449, these APIs are part of the web, not part of the JS language.

2 Likes