Skip to content

Conversation

tunetheweb
Copy link
Contributor

@tunetheweb tunetheweb commented Sep 4, 2025

Description

I noticed some inaccuracies in the LCP render time page:

  • The top of the page states 0 will be returned for cross-origin requests but this is not the case now.
  • Therefore you cannot use a non-zero render time as a measure whether the LCP is accurate.
  • Reword the startTime section as I found that difficult to understand.

I changed this in #37743 but missed these.

Motivation

Correct inaccuracies to avoid confusion

Additional details

Related issues and pull requests

Relates to: #37743
Relates to: w3c/largest-contentful-paint#138

@tunetheweb tunetheweb requested a review from a team as a code owner September 4, 2025 11:48
@tunetheweb tunetheweb requested review from wbamberg and removed request for a team September 4, 2025 11:48
@github-actions github-actions bot added Content:WebAPI Web API docs size/s [PR only] 6-50 LoC changed labels Sep 4, 2025
Copy link
Contributor

github-actions bot commented Sep 4, 2025

Preview URLs

External URLs (1)

URL: /en-US/docs/Web/API/LargestContentfulPaint
Title: LargestContentfulPaint

(comment last updated: 2025-09-13 10:35:52)

@jasonwilliams
Copy link

@tunetheweb
Copy link
Contributor Author

is https://developer.mozilla.org/en-US/docs/Web/API/PerformanceEntry/startTime#largest-contentful-paint still accurate?

Yes it is. In most cases now the renderTime will no longer be zero, but old Chromes will be. Plus we don't know yet how Safari will handle this (or any other browser engines).

Ultimately the wording there is still specified and also still matches the changes proposed here which still mention it might be zero.

Copy link
Collaborator

@wbamberg wbamberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand why the "### Cross-origin image render time" is duplicated. Is there a reason to not just have it in the page for renderTime?

@github-actions github-actions bot added size/m [PR only] 51-500 LoC changed and removed size/s [PR only] 6-50 LoC changed labels Sep 11, 2025
@tunetheweb
Copy link
Contributor Author

I don't understand why the "### Cross-origin image render time" is duplicated. Is there a reason to not just have it in the page for renderTime?

This is a somewhat fair comment. However, I'd prefer to have it duplicated for a couple of reasons:

  1. We're talking about what to use for LCP time. So although this nuance is in regards to renderTime, it affects the over all value to be used for this API.
  2. We recommend kinda ignoring renderTime anyway. So to bury this information in that page feels kinda like... well burying it.

Does that convince you at all that duplication, while not ideal, is important enough to have this on the top page?

@tunetheweb tunetheweb requested a review from wbamberg September 11, 2025 09:02
Copy link
Collaborator

@wbamberg wbamberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand why the "### Cross-origin image render time" is duplicated. Is there a reason to not just have it in the page for renderTime?

This is a somewhat fair comment. However, I'd prefer to have it duplicated for a couple of reasons:

  1. We're talking about what to use for LCP time. So although this nuance is in regards to renderTime, it affects the over all value to be used for this API.

  2. We recommend kinda ignoring renderTime anyway. So to bury this information in that page feels kinda like... well burying it.

Does that convince you at all that duplication, while not ideal, is important enough to have this on the top page?

This is a good point. But it's quite a complex bit of exposition and I do think duplicating it is tough on readers. As a reader I have to try to work out if this is actually exactly the same or if there are subtle differences I need to worry about. And then perhaps some maintainer will change one and not the other, and now there is a difference, and readers have to decide whether the difference is intentional or not.

My suggestion is to add a note to the interface page somewhat like:

To measure render time for cross-origin requests, set the {{httpheader("Timing-Allow-Origin")}} header.

To ensure more accurate results for cross-origin requests across all browsers, developers should use startTime instead of renderTime as the LCP value.

See Cross-origin image render time and Use startTime over renderTime for more details.

But I won't block approval on this, if you disagree.

@@ -30,6 +30,24 @@ Additional key paint moments are provided by the {{domxref("PerformancePaintTimi

{{InheritanceDiagram}}

### Cross-origin image render time

For security reasons, the value of the {{domxref("LargestContentfulPaint.renderTime", "renderTime")}} property was originally `0` if the resource is a cross-origin request. Instead the {{domxref("LargestContentfulPaint.loadTime", "loadTime")}} property should be used as a fallback. The {{domxref("PerformanceEntry.startTime", "startTime")}}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a sentence fragment here. I didn't know if you also wanted to keep the preceding sentence on "Instead..." - I have removed it in my suggestion because it seems to me to be covered in the next section ("Use startTime") and because I think "Browsers may now" flows better without it. But your call.

Suggested change
For security reasons, the value of the {{domxref("LargestContentfulPaint.renderTime", "renderTime")}} property was originally `0` if the resource is a cross-origin request. Instead the {{domxref("LargestContentfulPaint.loadTime", "loadTime")}} property should be used as a fallback. The {{domxref("PerformanceEntry.startTime", "startTime")}}
For security reasons, the value of the {{domxref("LargestContentfulPaint.renderTime", "renderTime")}} property was originally `0` if the resource is a cross-origin request.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK I've removed this whole section from the LCP page and referenced the section in the renderTime page as suggested.

So I made this suggested change in that page instead.


For security reasons, the value of the {{domxref("LargestContentfulPaint.renderTime", "renderTime")}} property was originally `0` if the resource is a cross-origin request. Instead the {{domxref("LargestContentfulPaint.loadTime", "loadTime")}} property should be used as a fallback. The {{domxref("PerformanceEntry.startTime", "startTime")}}

Browsers [may now expose a slightly coarsened render time](https://github.com/w3c/paint-timing/issues/104) in these situations. Check for [browser support](#browser_compatibility).
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This link goes to the interface BCD table, which doesn't show detailed compat for renderTime.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it does under cross-origin under renderTime:

image

I'm not convinced this is obvious to developer that this is what this represents but was asked to change it from my original suggestion of cross-origin-render-time

@tunetheweb
Copy link
Contributor Author

OK reworked it to have a lighter explanation on the LCP page and link to the heavier explanation on the renderTime page. PTAL!

@tunetheweb tunetheweb requested a review from wbamberg September 13, 2025 10:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content:WebAPI Web API docs size/m [PR only] 51-500 LoC changed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants