Skip to content

Commit c6b0042

Browse files
authored
Handle CSS2 series URLs as an exception to the rule (#1730)
For CSS2, we create a "CSS" series in browser-specs different from the "css" series for CSS snapshots but the W3C API mixes both, and the URL https://www.w3.org/TR/CSS/ that would logically be computed as series URL for the CSS series actually returns a CSS Snapshot. The update makes the code use the CSS2 spec URLs instead. An alternative would be to create a "CSS2" series instead, but that's well aligned with the current data in the W3C API.
1 parent 0ece4f7 commit c6b0042

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

src/compute-series-urls.js

+11-1
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,19 @@ function computeSeriesUrls(spec) {
1717

1818
const res = {};
1919

20+
// We create a "CSS" series in browser-specs for CSS2 different from the
21+
// "css" series for CSS snapshots but the W3C API mixes both, and the URL
22+
// https://www.w3.org/TR/CSS/ that would logically be computed as series URL
23+
// actually returns a CSS Snapshot. Let's use the spec URL instead
24+
// (https://www.w3.org/TR/CSS2/).
25+
if (spec.shortname === "CSS2") {
26+
res.releaseUrl = spec.url;
27+
res.nightlyUrl = spec.nightly.url;
28+
}
29+
2030
// If spec shortname and series shortname match, then series URLs match the
2131
// spec URLs.
22-
if (spec.shortname === spec.series.shortname) {
32+
else if (spec.shortname === spec.series.shortname) {
2333
if (spec.release?.url) {
2434
res.releaseUrl = spec.release.url;
2535
}

test/compute-series-urls.js

+14
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,20 @@ describe("compute-series-urls module", () => {
6666
});
6767

6868

69+
it("handles CSS2 correctly", () => {
70+
const spec = {
71+
url: "https://www.w3.org/TR/CSS2/",
72+
shortname: "CSS2",
73+
series: { shortname: "CSS" },
74+
release: { url: "https://www.w3.org/TR/CSS2/" },
75+
nightly: { url: "https://drafts.csswg.org/css2/" }
76+
};
77+
assert.deepStrictEqual(computeSeriesUrls(spec),
78+
{ releaseUrl: "https://www.w3.org/TR/CSS2/",
79+
nightlyUrl: "https://drafts.csswg.org/css2/" });
80+
});
81+
82+
6983
it("returns right nightly URL for series when spec's nightly has no level", () => {
7084
const spec = {
7185
url: "https://www.w3.org/TR/pointerlock-2/",

0 commit comments

Comments
 (0)