Skip to content

Commit

Permalink
Add release date for support statements with multiple versions (#2995)
Browse files Browse the repository at this point in the history
* Add release date for support statements with multiple versions

The code that added in the release date did not account for support
statements that involve multiple releases (for example, a version with
flags and then a version with full support), so these entries did not
have a release date tooltip in the compatibility table.

This commit extends the release date addition to annotate the release
date for all versions in a support statement.

* Standardize the data, don't deal with two forms

Just ensure we always are dealing with an array
  • Loading branch information
cincodenada authored Apr 12, 2021
1 parent 80c0e56 commit 157a86a
Showing 1 changed file with 20 additions and 7 deletions.
27 changes: 20 additions & 7 deletions build/document-extractor.js
Original file line number Diff line number Diff line change
Expand Up @@ -311,13 +311,26 @@ function _addSingleSectionBCD($) {
block = compat.__compat;
}
if (block) {
for (const [browser, info] of Object.entries(block.support)) {
const added = info.version_added;
if (browserReleaseData.has(browser)) {
if (browserReleaseData.get(browser).has(added)) {
info.release_date = browserReleaseData
.get(browser)
.get(added).release_date;
for (let [browser, info] of Object.entries(block.support)) {
// `info` here will be one of the following:
// - a single simple_support_statement:
// { version_added: 42 }
// - an array of simple_support_statements:
// [ { version_added: 42 }, { prefix: '-moz', version_added: 35 } ]
//
// Standardize the first version to an array of one, so we don't have
// to deal with two different forms below
if (!Array.isArray(info)) {
info = [info];
}
for (const infoEntry of info) {
const added = infoEntry.version_added;
if (browserReleaseData.has(browser)) {
if (browserReleaseData.get(browser).has(added)) {
infoEntry.release_date = browserReleaseData
.get(browser)
.get(added).release_date;
}
}
}
}
Expand Down

0 comments on commit 157a86a

Please sign in to comment.