Skip to content

[css-values-5] Clarify how to parse <if-args-branch> #12487

@cdoublev

Description

@cdoublev

https://drafts.csswg.org/css-values-5/#typedef-if-args-branch

<if-args-branch> = <declaration-value> : <declaration-value>?

<declaration-value> accepts : so : <declaration-value>? seems unreachable... unless a CSS parser is supposed to backtrack, drop the last token matched for <declaration-value>, then resume parsing? Or should it be <declaration-value> [ : <declaration-value>? ]??

I have a more specific question about the spread syntax. (edit) Never mind: since . . . var(--custom) is valid at parse time, I guess ...var() is too.

I could open a separate issue but the spread syntax seems only relevant for <if-args-branch> if I am not mistaken, since the argument grammars of other arbitrary substitutions take a comma-separated <declaration-value>, so they will always get a match.

This behavior can be worked around by immediately preceding an arbitrary substitution function with the spread syntax ..., indicating that it must be resolved "early", before division into arguments.

What is accepted (at parse time) after ...? Only an arbitrary substitution? Should it be valid itself? (eg. if(...if()))

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