Skip to content

Document spec_url guidelines#29582

Open
Elchi3 wants to merge 2 commits intomdn:mainfrom
Elchi3:spec-url-docs
Open

Document spec_url guidelines#29582
Elchi3 wants to merge 2 commits intomdn:mainfrom
Elchi3:spec-url-docs

Conversation

@Elchi3
Copy link
Copy Markdown
Member

@Elchi3 Elchi3 commented Apr 30, 2026

Summary

I would like to move forward with better spec_url implementation and validation in BCD.

In order to review big PRs like #29223, I think it makes sense to paint the bigger picture, so this is what this PR does: Document the spec_url property properly and start collecting best practices as data guidelines.

Test results and supporting details

No tests, this is project documentation only.

Related issues

@Elchi3 Elchi3 requested a review from a team as a code owner April 30, 2026 14:20
@github-actions github-actions Bot added schema Isses or pull requests regarding the JSON schema files used in this project. docs Issues or pull requests regarding the documentation of this project. size:m [PR only] 25-100 LoC changed labels Apr 30, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 30, 2026

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

@Elchi3
Copy link
Copy Markdown
Member Author

Elchi3 commented Apr 30, 2026

For CSS spec linking guidelines, there are some thoughts here: web-platform-dx/web-features#1785. I don't think we consider these in BCD yet, but we could decide to leave a pointer in our docs in case we want to make more decisions about this at a later point.

Comment thread docs/data-guidelines/spec_links.md Outdated

## Best practices

In addition to the validated rules above, the following best practices have emerged:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Something I'd like to see here is general guidance about the number of spec URLs (e.g., when to use more than one spec URL).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

In 226c1b5 I've added that, most of the time, you want just one URL.

Each URL must link to a specification published by a standards body or a formal proposal that may lead to such publication.
To determine whether a specification host is valid, BCD relies on data from the [w3c/browser-specs](https://github.com/w3c/browser-specs) project.

If a specification is listed in browser-specs and has a [standing](https://github.com/w3c/browser-specs#standing) of "good", the URL will be accepted in BCD's `spec_url` field.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Maybe mention exceptions. Afaik we have a list of spec URL prefixes that we allow anyhow?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Cf. #29601

Comment thread docs/data-guidelines/spec_links.md
Copy link
Copy Markdown
Contributor

@caugner caugner left a comment

Choose a reason for hiding this comment

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

Before merging this PR, it should be helpful to review the changes over in #29223. Some changes in there probably don't align with these guidelines, and those will be a good opportunity to check them.

Overall, I agree with the guidelines, but I think it could include some special case patterns that occur in our data, mostly due to imperfections in BCD and specs.

Examples:

  • BCD features grouping related features, such as cookie prefixes, or related values (e.g. "left and right values"). The fix probably is to split them up, but it would be good to acknowledge those existing case.
  • BCD behavioral features in CSS that correspond to a somewhat deeply nested type in the formal definition of a property. In this case, I have found it helpful for now to capture the type chain via multiple spec URLs. Another solution in the future could be to have a separate internal field to clarify what the feature refers to, which allows the description to be developer focused.
  • BCD features that combine two related yet distinct features, such as animation of the before pseudo element. I would say that setlike/maplike/iterable also falls in this category, because these features are specified by the interface declaring this, and the setlike/maplike/iterable definition.
  • SVG properties are sometimes mentioned in the SVG spec but refer back to the CSS spec. I would argue that listing both spec URLs is helpful there.
  • Some CSS properties have an initial definition in one level of a spec, and are completed in a subsequent diff spec. Again, listing both makes sense to me here.
  • Some API Interfaces have a core definition, and are extended in other specs. While we could just mention the spec extensions on the members that are subject of the extension, I think it wouldn't hurt listing the extensions also on the interface itself.


If BCD's linter complains about the provided URL, you will need to check its state within browser-specs. Common scenarios include:

- The specification is not yet part of browser-specs. Check whether an issue already exists; if not, open one one and ask whether the W3C would consider adding the specification.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
- The specification is not yet part of browser-specs. Check whether an issue already exists; if not, open one one and ask whether the W3C would consider adding the specification.
- The specification is not yet part of browser-specs. Check whether an issue already exists; if not, open one and ask whether the W3C would consider adding the specification.


### Maplikes, Setlikes, Iterables

When the interface has "entries", "forEach", "get", "has", "keys", "values", "@@iterator" methods and a "size" getter via "maplike", "setlike", or "iterable" IDL constructs, link to the interface containing the definition and not to the IDL standard.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I have argued before that referencing the IDL construct or the method defined by the construct would make it easier to identify in the BCD data where this feature comes from. Using two spec URLs, one pointing to the interface, and the other pointing to the specification of the construct member would provide clarity. Alternatively, we could capture this in a separate internal (?) field.


### Worker support, secure_context_required

For BCD keys named `worker_support` and `secure_context_required`, link to the main interface specification, since these IDL flags appear alongside the interface definition (for example, `[SecureContext, Exposed=(Window,Worker)]`).
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

IIRC secure_context_required is not only used for interfaces.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Issues or pull requests regarding the documentation of this project. schema Isses or pull requests regarding the JSON schema files used in this project. size:m [PR only] 25-100 LoC changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants