Skip to content

[css-conditional-5] Style and media ranges are inconsistent #12425

Open
@cdoublev

Description

@cdoublev

(This is a follow-up of recent changes from #12401 following the resolution in #8376 (comment).)

They accept different range values:

  • media: <number>, <dimension>, <ratio>
  • style: <number>, <percentage>, <length>, <angle>, <time>, <frequency>, <resolution>

There is probably a reason to restrict dimension types for style range values. But I suspect that <flex> and <ratio> should be valid.

(No media feature values accept <percentage> so this difference may be is normal, but I wonder if it should be valid for future compat with a media feature value accepting a raw percentage, to make its query evaluate to unknown... which is off topic.)

Style range values are actually defined with <declaration-value> and validated against the above numeric types at evaluation time. If this validation fails, it evaluates to false. If I am not mistaken, a consequence is that not style(1px < 1unknown) evaluates to true instead of unknown, which becomes false at the top-level, like for not media(width < 1unknown). (This assumes that media() - and other functional conditions - are always used in a context accepting <general-enclosed> as a fallback.)

So I just want to make sure that these differences are not an oversight.

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