mdn / mdn/browser-compat-data

How should we represents features implemented on different interfaces.

Open
#3,584 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

data:api docs:guidelines idle question schema
Dominant language
JSON
Stars
5.8k
Forks
2.6k
Avg merge
1d 21h
Merged PRs (30d)
186

Description

We have instances of what seem to be the same feature implemented on different interfaces in different browsers. Here are two examples:

  • animationend, animationiteration, and animationstart are implemented on Window in Chrome, but on Document in other browsers. (See #3583)
  • delegatesFocus may be implemented on Element for some browsers, but is implemented on ShadowRoot for Chrome. (See #3580)

These two instances are likely the result of spec changes. My guess is that Chrome is behind the spec change in the first item, but ahead of it in the second.

It seems like alternative_name could be used for this. So under api.Window.animationend.chrome would be "alternative_name": "Document.animationend". And api.Document.animationend.chorme would have "alternative_name": "Window.animationend". That would provide enough information for a consuming app to locate the alternative data.

Disambiguation between this and cases where the alternative is not also a key is easily handled in code.

// Getting the alt tree is a little more complicated, so I went simple to make the point.
const altTree = bcd[altName];
if (altTree) {
  // Render the data.
}

If this is the correct approach and no schema change is needed, then this is merely a documentation change and I'll submit a PR for it.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the examples in this issue and the related issues #3583 and #3580, then inspect the browser-compat-data schema and validation guidance. Determine whether alternative_name can represent cross-interface implementations or whether a schema change is needed. Done means the representation is agreed and either documented in the data guidance or specified for implementation.

Written by the indexing model from the issue text.

Assessment

Tech stack
json
Domain
data
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.