Skip to content

Container style queries with range syntax #4460

Closed

Description

@woody-li

Activity

  1. dosubot commented on Jul 2, 2026

    @dosubot

    Hi @woody-li! I'm Dosu and I'm helping the Personal team.

    This looks like a genuine parsing bug. Less.js has a built-in style() function [1] that conflicts with the CSS container query style() syntax.

    What's happening: When the parser encounters @container style(var(--n) = 3), the mediaFeature() parser calls declarationCall() which greedily matches style( as a Less function call [2]. It then tries to parse the contents (var(--n) = 3) as Less function arguments. Since the = operator isn't valid in that context, the parser fails to find the closing ) and throws "Missing closing ')'".

    Root cause: Less.js registers style() in its function registry [3] as a built-in function that evaluates arguments as Less variables. Unlike other special functions (e.g., alpha(), boolean(), if()) which have custom parsing handlers [4], there's no context-aware logic to recognize that style() inside a @container query should be passed through as raw CSS rather than evaluated as a Less function.

    The parser does have lookahead logic for detecting comparison operators like =, <, > in media/container queries [5], but this never activates because declarationCall() has already committed to parsing style( as a function call before the comparison operator handling gets a chance to run.

    This appears to be a new, unreported issue — I didn't find any prior conversations or existing issues tracking it.

    To reply, just mention @dosu.


    Docs are dead. Just use Dosu.

    Leave Feedback Ask Dosu about less.js Share Dosu with your team

  2. added a commit that references this issue on Jul 12, 2026
    d38b43a
  3. added a commit that references this issue on Aug 1, 2026
    937d1e4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions