[css-contain] Is there a use-case for querying explicit container selectors? (original) (raw)

@dbaron's original proposal included an explicit selector for the container to be queried:

@container ()? { // ... rules ... }

In part, that's explained as a way to implement scope as part of containment. But I'm not sure those two features always make sense together, and all the CQ use-cases I've encountered so far rely on:

Requiring an explicit selector would make those use-cases more difficult, since it makes the query less modular, and potentially less relevant to immediate context. That said, if the selector is useful in some cases, we could consider allowing it as an optional syntax:

@container ()? ()? { // ... rules ... }

Aside:

I can imagine some hypothetical use-cases, though most would be solved by using descendant selectors (or @scope) along with container queries. In those cases it might be syntax sugar, but doesn't provide much. More important would be any use-cases where an author wants to "skip over" the most immediate container context, and query a container farther up in the DOM tree. Do those use-cases exist?