mdn / browser-compat-data

This repository contains compatibility data for Web technologies as displayed on MDN
https://developer.mozilla.org
Creative Commons Zero v1.0 Universal
4.96k stars 1.99k forks source link

Notes with version ranges #17857

Open foolip opened 2 years ago

foolip commented 2 years ago

Notes are used a lot in BCD to inform readers about specific bugs that affect certain versions of a browser. There are two predominant styles for this, shown by example here:

A note including the affected version:

https://github.com/mdn/browser-compat-data/blob/11afcd744d551964b05c40de52008f8c0db0ee2f/css/properties/align-self.json#L93-L96

Multiple support statements, using version_added and version_removed:

https://github.com/mdn/browser-compat-data/blob/11afcd744d551964b05c40de52008f8c0db0ee2f/api/Element.json#L2651-L2661

The data for the "visibilitychange" change event in https://github.com/mdn/browser-compat-data/issues/17854 is great example of how complicated things can get with the multi-statement style, requiring repeated notes.

Some issues with the current approach:

I would like us to consider adopting a different structure, where notes can have version ranges independent from the main version_added and version_removed. Mock proposal with the "visibilitychange" case, with simplified notes to make it cleaner:

{
  "version_added": "7",
  "notes": [
    {
      "version_fixed": "14.1",
      "note": "The event is not fired when navigating away from a document."
    },
    {
      "version_fixed": "14",
      "note": "The event does not bubble."
    },
    {
      "version_fixed": "10.1",
      "partial_implementation": true,
      "note": "The <code>onvisibilitychange</code> event handler property is not supported"
    }
  ]
}

cc @Elchi3 @queengooborg

foolip commented 2 years ago

@Fyrd do you have thoughts on what would work best for caniuse.com?

foolip commented 1 year ago

cc @ddbeck

ddbeck commented 1 year ago

I love the idea of adding structure to notes—it's something I've long wished for. There's a lot to be won from structuring notes, both in terms of data quality and consistency and making it work better for consumers.

Thinking aloud here:

foolip commented 6 months ago

https://github.com/mdn/browser-compat-data/pull/22939 is a good example of the need for this. I needed to use 6 entries in the compat statements array, because the API was both prefixed and unprefixed, and there were two different states of partial support. 2 times 3 is 6.