Skip to content

Add {InteractionContentfulPaint|PerformanceSoftNavigation}.toJSON - #30334

Merged
Elchi3 merged 5 commits into
mdn:mainfrom
Elchi3:interactioncontentfulpaint-tojson
Sep 3, 2026
Merged

Elchi3 merged 5 commits into
mdn:mainfrom
Elchi3:interactioncontentfulpaint-tojson

Conversation

@Elchi3

@Elchi3 Elchi3 commented Aug 26, 2026

Copy link
Copy Markdown
Member

Summary

We missed this in #30195.

cc. @tunetheweb

Test results and supporting details

Discovered by the OWD BCD collector 10.20.8.

Related issues

#30195

@github-actions github-actions Bot added data:api Compatibility data for Web API features. https://developer.mozilla.org/docs/Web/API size:m Pull request changing 25-100 lines of code. labels Aug 26, 2026
@github-actions

github-actions Bot commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

Tip: Review these changes grouped by change (recommended for most PRs), or grouped by feature (for large PRs).

@tunetheweb

tunetheweb commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

Yes this looks correct to me by spec.

@mmocny why does InteractionContentfulPaint have a dedicated toJSON() function in it's IDL, but PerformanceSoftNavigation does not (but it still works — presumably as it's inherited from PeformanceEntry)?

Is it because InteractionContentfulPaint needs to override the PeformanceEntry.toJSON to add largestContentfulPaint because objects don't get included by default, but since attributes do PerformanceSoftNavigation has no need to override it?

@mmocny

mmocny commented Aug 26, 2026

Copy link
Copy Markdown

This wasn't an explicit decision that I can recall, so could just be an oversight-- but I will investigate if it is correct to remove both, add both, or leave as is...

@tunetheweb

Copy link
Copy Markdown
Contributor

And, depending on how that investigation does, I might have a similar question on LCP btw: https://w3c.github.io/largest-contentful-paint/#dom-largestcontentfulpaint-tojson :-) We might need to do a full audit of all Performance API specs.

@mmocny

mmocny commented Aug 26, 2026

Copy link
Copy Markdown

I think I need to add toJSON() to PerformanceSoftNavigation, as it doesn't just work via inheritance. I think that ICP having this explicitly defined was specifically because it evolved from LCP spec and so we inherited it.

I'll put up a fix.


(Also, the correct syntax should be [Default] object toJSON(); which we missed, I'll fix that too, and might be worth auditing other specs as you suggested)

@tunetheweb

Copy link
Copy Markdown
Contributor

Cool. Will add a note to myself to add to MDN (BCD and Content) once it makes it's way into the spec.

Or @Elchi3 will the BCD side happen automatically with your collector? Any ideas why it didn't add the iCP and SoftNav ones or was I just too impatient?

@Elchi3

Elchi3 commented Aug 26, 2026

Copy link
Copy Markdown
Member Author

You were too impatient :) (or rather the browser-specs/webref projects were too slow adding the spec).

If the IDLs get corrected in the specs, they will make their way through webref -> collector -> bcd.

mmocny added a commit to mmocny/soft-navigations that referenced this pull request Aug 26, 2026
…nteractionContentfulPaint

Under WebIDL § 3.7.7.1.1, subclasses of PerformanceEntry do not
automatically include their own attributes in toJSON() through
inheritance unless the subclass explicitly declares a default toJSON
operation ([Default] object toJSON();). Without this, calling toJSON() on
a PerformanceSoftNavigation instance only serializes the base
PerformanceEntry properties, omitting navigationType, interactionId, and
PaintTimingMixin attributes.

This change:
- Adds [Default] object toJSON(); to PerformanceSoftNavigation.
- Updates InteractionContentfulPaint to include the [Default] extended
  attribute on toJSON().
- Adds corresponding prose to run default toJSON steps when toJSON()
  is called for both interfaces, matching sibling WebPerf specs.

Original issue: mdn/browser-compat-data#30334
mmocny added a commit to mmocny/soft-navigations that referenced this pull request Aug 26, 2026
…nteractionContentfulPaint

Under WebIDL § 3.7.7.1.1, subclasses of PerformanceEntry do not
automatically include their own attributes in toJSON() through
inheritance unless the subclass explicitly declares a default toJSON
operation ([Default] object toJSON();). Without this, calling toJSON() on
a PerformanceSoftNavigation instance only serializes the base
PerformanceEntry properties, omitting navigationType, interactionId, and
PaintTimingMixin attributes.

This change:
- Adds [Default] object toJSON(); to PerformanceSoftNavigation.
- Updates InteractionContentfulPaint to include the [Default] extended
  attribute on toJSON().
- Adds corresponding prose to run default toJSON steps when toJSON()
  is called for both interfaces, matching sibling WebPerf specs.

Original issue: mdn/browser-compat-data#30334
mmocny added a commit to mmocny/soft-navigations that referenced this pull request Aug 26, 2026
…nteractionContentfulPaint

Under WebIDL § 3.7.7.1.1, subclasses of PerformanceEntry do not
automatically include their own attributes in toJSON() through
inheritance unless the subclass explicitly declares a default toJSON
operation ([Default] object toJSON();). Without this, calling toJSON() on
a PerformanceSoftNavigation instance only serializes the base
PerformanceEntry properties, omitting navigationType, interactionId, and
PaintTimingMixin attributes.

This change:
- Adds [Default] object toJSON(); to PerformanceSoftNavigation.
- Updates InteractionContentfulPaint to include the [Default] extended
  attribute on toJSON().
- Adds corresponding prose to run default toJSON steps when toJSON()
  is called for both interfaces, matching sibling WebPerf specs.

Original issue: mdn/browser-compat-data#30334
mmocny added a commit to WICG/soft-navigations that referenced this pull request Aug 26, 2026
…nteractionContentfulPaint (#91)

Under WebIDL § 3.7.7.1.1, subclasses of PerformanceEntry do not
automatically include their own attributes in toJSON() through
inheritance unless the subclass explicitly declares a default toJSON
operation ([Default] object toJSON();). Without this, calling toJSON() on
a PerformanceSoftNavigation instance only serializes the base
PerformanceEntry properties, omitting navigationType, interactionId, and
PaintTimingMixin attributes.

This change:
- Adds [Default] object toJSON(); to PerformanceSoftNavigation.
- Updates InteractionContentfulPaint to include the [Default] extended
  attribute on toJSON().
- Adds corresponding prose to run default toJSON steps when toJSON()
  is called for both interfaces, matching sibling WebPerf specs.

Original issue: mdn/browser-compat-data#30334
@Elchi3 Elchi3 changed the title Add InteractionContentfulPaint.toJSON Add {InteractionContentfulPaint|PerformanceSoftNavigation}.toJSON Sep 3, 2026
@github-actions

github-actions Bot commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

The lint check found auto-fixable issues. Apply suggested changes (attributed to bcd-linter), or to fix all at once, run npm run lint:fix locally.

See also: Automated lint suggestions on pull requests

Elchi3 and others added 2 commits September 3, 2026 13:06
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Comment thread api/InteractionContentfulPaint.json
Comment thread api/PerformanceSoftNavigation.json
Comment thread api/InteractionContentfulPaint.json Outdated
Comment thread api/PerformanceSoftNavigation.json
Comment thread api/PerformanceSoftNavigation.json Outdated
@Elchi3
Elchi3 merged commit ea27cd9 into mdn:main Sep 3, 2026
10 checks passed
@Elchi3
Elchi3 deleted the interactioncontentfulpaint-tojson branch September 3, 2026 11:13
@mdn-bot mdn-bot mentioned this pull request Sep 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

data:api Compatibility data for Web API features. https://developer.mozilla.org/docs/Web/API size:m Pull request changing 25-100 lines of code.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants