webref icon indicating copy to clipboard operation
webref copied to clipboard

Missing syntax for several CSS types

Open caugner opened this issue 1 month ago • 2 comments

Background

We have deprecated mdn-data, and recommend consumers to migrate to @webref/css, but it appears that mdn-data includes some data that is missing in webref. (See also: https://github.com/csstree/csstree/pull/355/files#r2585312764)

Problem

The following 115 types have no syntax in css.json:

https://drafts.csswg.org/css-animations-2/

https://drafts.csswg.org/css-box-4/

https://drafts.csswg.org/css-cascade-6/

https://drafts.csswg.org/css-color-4/

https://drafts.csswg.org/css-conditional-5/

https://drafts.csswg.org/css-counter-styles-3/

https://drafts.csswg.org/css-extensions-1/

https://drafts.csswg.org/css-fonts-4/

https://drafts.csswg.org/css-grid-2/

https://drafts.csswg.org/css-lists-3/

https://drafts.csswg.org/css-mixins-1/

https://drafts.csswg.org/css-overflow-5/

https://drafts.csswg.org/css-page-3/

https://drafts.csswg.org/css-shapes-1/

https://drafts.csswg.org/css-speech-1/

https://drafts.csswg.org/css-syntax-3/

https://drafts.csswg.org/css-transforms-2/

https://drafts.csswg.org/css-ui-4/

https://drafts.csswg.org/css-values-4/

https://drafts.csswg.org/css-values-5/

https://drafts.csswg.org/css-variables-2/

https://drafts.csswg.org/css2/

https://drafts.csswg.org/mediaqueries-5/

https://drafts.csswg.org/pointer-animations-1/

https://drafts.csswg.org/scroll-animations-1/

https://drafts.csswg.org/selectors-4/

https://drafts.csswg.org/selectors-5/


Generated by opening https://unpkg.com/@webref/css/css.json in Firefox, and running the following snippet in Firefox DevTools:

Object.entries(
  $json.data.types
    .filter((type) => !type.syntax)
    .map((type) => [
      type.href.split("#")[0],
      `- [\`<${type.name}>\`](${type.href})`,
    ])
    .toSorted()
    .reduce((map, [key, item]) => {
      map[key] ||= [];
      map[key].push(item);
      return map;
    }, {}),
)
  .map(([key, items]) => `### ${key}\n\n${items.join("\n")}`)
  .join("\n\n");

caugner avatar Dec 03 '25 14:12 caugner

Same issue here. We also need these types to migrate from mdn-data to @webref/css for csstype.

frenic avatar Dec 10 '25 08:12 frenic

@caugner the list you compiled contains constructs that do not have a syntax either in mdn/data. For example, all <[something]-token> types. For a more specific analysis of differences between mdn/data and @webref/css, see Syntax mismatches between MDN data and Webref which I just re-generated. The most interesting bits are constructs that have "webref: unknown syntax", ~50 in total.

The reason why these constructs do not have a syntax in Webref is that the underlying specs do not define the syntax in a machine-readable way, sometimes on purpose. In other cases, specs could perhaps be improved over time (21 of the missing syntaxes are for selectors, whose syntax tends to be somewhat hidden in specs).

We'll look into adding a simple mechanism to patch the data and add missing syntaxes, leveraging the contents of mdn/data for these ~50 constructs.

By definition, these patches will have to be maintained manually. As noted in #1647 (which discusses this approach for <system-color> and <deprecated-color>), we're happy to coordinate the patches in Webref but we're likely going to do a poor job at maintaining the data ourselves. We're going to need help from people who actually need the data, to maintain the patches (or to push updates to the specs when that seems appropriate).

tidoust avatar Dec 10 '25 09:12 tidoust