Skip to content

[css-grid] Mark up minmax() and fit-content() as functions in the spec? #7682

@wbamberg

Description

@wbamberg

I've been working on displaying the syntax of CSS features on MDN, via the webref package. We do this using a macro that uses fetches the syntax from webref, then tries to render it nicely, like: https://developer.mozilla.org/en-US/docs/Web/CSS/border#formal_syntax.

There are a few places where this isn't working: two that I have found are minmax() and fit-content(). These look like functions, and the MDN pages are tagged as functions, but in the specs they are not marked up as functions, so they don't appear in webref, and we're not able to show any syntax for them on MDN.

There's more on this here: mdn/content#18780 (comment) :

Finally <minmax()> doesn't seem to have an entry at all although it is listed as a component of some other types. Again, the same applies to some other functions, like <fit-content()>, where we don't see an error because our fit-content() page does not attempt to include formal syntax.

Both minmax() and fit-content() look like CSS functions but they are not defined as CSS functions (the spec defines them with a data-dfn-type="value" and not a data-dfn-type="function"). They are rather defined as "simple" values as auto or inherit. If they were real CSS functions, the definition of <track-size> would not be:

<track-breadth> | minmax( <inflexible-breadth> , <track-breadth> ) | fit-content( <length-percentage> )

... but rather

<track-breadth> | <minmax()> | <fit-content()>

Why is that? I don't know :) You may want to ask the CSS working group why they sometimes decide to create functions and sometimes decide to leave them as pure textual syntax. It may not be intentional.

So I wondered whether there's a reason that these features are not marked up as functions in the specs.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions