Skip to content

Should common @when and if() functions be the same? #12903

@dbaron

Description

@dbaron

The @when rule defines media() and supports() functions. The if() function defines supports(), media() and style() functions.

I understand (I think) that style() is only present for if() because if is in a value context, so style queries are possible, whereas @when is in a rule context. (But see container queries! Though I think those impose additional constraints which may be a good reason to keep them out of @when.)

However, I'm curious why there are differences in the definitions of the supports() and media() functions between these contexts. I'd initially expect them to be the same, although maybe there are good reasons for them to be different. (If so, it would be good to document them.) Should these functions basically be the same? Should they even have a common definition (which other types of conditions may add to in the future)?

(It's not clear to me that any of the current differences are substantive... but they're definitely defined in different ways right now.)

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