Skip to content

[css-conditional-5] CSSContainerRule.containerName/containerQuery should return a list #10845

Closed

Description

@cdoublev

(Follow-up on this comment.)

According to this resolution, the @container prelude grammar accepts a list of <container-condition>s:

@container <container-condition># { <block-contents> }

<container-condition> = [ <container-name> ]? <container-query>

But CSSContainerRule.containerQuery and CSSContainerRule.containerName still return a single container query/name.

Can you please tell me if there is any reason to withhold the appropriate changes on the CSSOM? Do you plan to rename the attributes? To remove them? To return a list of strings or a string of comma-separated values?

The current version of Chrome/FF (at least) only accept a single <container-condition>.

Activity

  1. moved this to FTF agenda items in CSSWG January 2025 meetingon Jan 22, 2025
  2. moved this from FTF agenda items to Regular agenda items in CSSWG January 2025 meetingon Jan 22, 2025
  3. css-meeting-bot commented on Mar 19, 2025

    @css-meeting-bot
    Member

    The CSS Working Group just discussed [css-conditional-5] `CSSContainerRule.containerName`/`containerQuery` should return a list, and agreed to the following:

    • RESOLVED: Editors will figure out how to fix the OM to match the new behavior, and bring it back to the group for review
    The full IRC log of that discussion <TabAtkins> astearns: miriam, this was months ago, but you put this on the agenda last year
    <TabAtkins> miriam: okay, let's review...
    <TabAtkins> miriam: we resolved earlier that a @container prelude could accept a list of conditions, but we didn't update the CSSOM to return a list
    <TabAtkins> miriam: so the proposal is that CSSOM should reflect that list back to us
    <TabAtkins> astearns: it's mentioned that none of the impls do it yet
    <TabAtkins> miriam: at least, last yes, yes
    <emilio> s/yes, yes/year, yes
    <TabAtkins> astearns: so proposed resolution is to update CSSOM to match the resolution?
    <kbabbitt> seems reasonable to me
    <TabAtkins> miriam: yes
    <TabAtkins> emilio: is the proposal to return a readonly sequence?
    <TabAtkins> TabAtkins: i was thinking about that too. either it's readonly, or it could be settable but the list you get from the getter is "dead", doesn't reflect back into the object if you mutate
    <TabAtkins> astearns: i think guillaume's PR doens't mention the read/write nature of the list
    <TabAtkins> emilio: some back compat too. for the single-condition case, it might need to still return a string
    <TabAtkins> astearns: do you think it's reasoanble to resolve on returning the list and find out if we have compat problems?
    <emilio> TabAtkins: if today we allow a comma-separated list, how is it reflected? Just comma-separated list?
    <emilio> ... if so it might be worth keeping the property alone
    <emilio> ... and just have a function to get the listified version
    <TabAtkins> miriam: maybe more complicated, containerName wouldn't make sense if it was returning the whole prelude
    <TabAtkins> miriam: maybe nobody is usign the feature yet?
    <TabAtkins> TabAtkins: propose we just reoslve to fix, and let editors figure out what it should look like
    <TabAtkins> astearns: and who shoudl edit it?
    <TabAtkins> TabAtkins: miriam or emilio?
    <TabAtkins> emilio: this sounds reasonable. note that Firefox doesn't support multiple conditions yet, so it's not an issue for us.
    <TabAtkins> emilio: maybe other browsers dont' eitehr, presumably they'd have run into this containerName issue too
    <TabAtkins> astearns: so proposed resolution is we'll accommodate our intent in the CSSOM spec, but leave details to the editors to figure out what is possible given the constraints
    <TabAtkins> miriam: can we get a little further? do we just have one property that returns a list, or a string property plus a list accessor?
    <TabAtkins> astearns: i'd prefer only one, but i don't know if it's possible
    <TabAtkins> emilio: i agree if we coudln't return a list...
    <TabAtkins> emilio: but also the name is optional. if you have multiple container conditions, what are the names...?
    <TabAtkins> emilio: if you have three conditions, only the first and third have a name...
    <TabAtkins> TabAtkins: this is why i suggested leaving the details to the editors, i think they'd be pretty obvious once you start working it out
    <TabAtkins> emilio: yeah, we can try to sort it out and come back with a more fleshed out proposal
    <TabAtkins> miriam: sure
    <TabAtkins> astearns: so we're resolved to fix this, and bring the solution back to the group
    <TabAtkins> astearns: objections?
    <TabAtkins> RESOLVED: Editors will figure out how to fix the OM to match the new behavior, and bring it back to the group for review
  4. mirisuzanne commented on Mar 19, 2025

    @mirisuzanne
    Contributor

    It looks like we currently return an empty string for containerName when no name is defined. I imagine we would do the same thing in a returned list.

    We also resolved to allow name-only queries, which means the containerQuery can also become empty – which needs to be updated as well. I expect that should also return an empty string when missing? And then would return an empty string in a list if there are multiple?

    It's not clear to me if conditionText should remain a string of all conditions, or if it should also become a list of names/conditions?

    /cc @emilio

  5. emilio commented on Mar 19, 2025

    @emilio
    Collaborator

    Probably worth for conditionText to keep the whole thing for consistency with @media and so on.

    And I guess that mean that you could reconstruct all the conditions by "zipping" the names and queries.

  6. mirisuzanne commented on Mar 19, 2025

    @mirisuzanne
    Contributor

    @emilio If that sounds good to you, I'd call it a design / proposal. At this point I still feel very unfamiliar with defining CSSOM, especially the grammars. I could open a PR with a prose description of the proposed behavior, but would need help with the details.

  7. emilio commented on Mar 19, 2025

    @emilio
    Collaborator

    Sure, would mostly be a matter of changing the WebIDL to return something like a FrozenArray<CSSOMString> or so

  8. added a commit that references this issue on Mar 12, 2026
    48f7aba
  9. 7 remaining items

  10. css-meeting-bot commented on Mar 25, 2026

    @css-meeting-bot
    Member

    The CSS Working Group just discussed [css-conditional-5] `CSSContainerRule.containerName`/`containerQuery` should return a list, and agreed to the following:

    • RESOLVED: Adopt emilio's proposed design.
    The full IRC log of that discussion <fantasai> emilio: Resolved previously to [?], but didn't have a good way to present in OM
    <fantasai> emilio: But this is in Interop 2026 so we need to know
    <TabAtkins> +1 to emilio's design
    <fantasai> emilio: I suggested that .containerQuery and .containerName return empty string if multiple values
    <fantasai> emilio: and then return a disctionary separately
    <kbabbitt> s/[?]/have multiple conditions in CSSContainerRule/
    <fantasai> emilio: [missed]
    <ChrisL> s/disc/dict/
    <emilio> https://github.com//pull/13635
    <Rossen> ack kizu
    <Rossen> ack fantasai
    <Rossen> fantasai: was wondering if name and qry and is comma separated?
    <Rossen> emilio: name and qry and both are optional but at least one is needed
    <fantasai> fantasai: name is nullable but query isn't?
    <Rossen> https://github.com//issues/10845#issuecomment-4046359463
    <TabAtkins> dictionary ContainerCondition {
    <TabAtkins> CSSOMString? name;
    <TabAtkins> CSSOMString query;
    <TabAtkins> };
    <TabAtkins>
    <TabAtkins> readonly attribute FrozenArray<ContainerCondition> conditions;
    <jfkthame> In the PR https://github.com//pull/13635/changes/a962648547f5d9407cea877fcb7fdcfb4b4471ed both strings are required
    <fantasai> emilio: Spec PR gets it right
    <fantasai> RESOLVED: Adopt emilio's proposed design.
  11. added 3 commits that reference this issue on Mar 26, 2026
    4e66daf
    16a3d39
    b4582b8
  12. emilio commented on Mar 27, 2026

    @emilio
    Collaborator
  13. cdoublev commented on Mar 28, 2026

    @cdoublev
    CollaboratorAuthor

    @emilio, should I open a new issue for the following, and ask for some usage analytics?

    We should try to remove containerName and containerQuery, since they don’t deal with multiple conditions correctly.

    And given that the attributes return an empty string when there is more than one value, don't you think they should be defined as deprecated members in a separate partial interface?

  14. emilio commented on Mar 29, 2026

    @emilio
    Collaborator

    @cdoublev sure, I added use counters in the Mozilla patch implementing this. But having an issue open and referencing it in the spec, or so, seems fine to me :)

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

    css-conditional-5

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions