Skip to content

[css-pseudo-4] "Singular" vs "plural" pseudo-elements #9968

Open
@tabatkins

Description

@tabatkins

We discussed in the F2F that a few things being worked on need to be able to distinguish whether a pseudo-element is "singular" or "plural" - that is, if you target the pseudo-element (via a selector, a getComputedStyle() argument, etc) from a particular originating element, will you necessarily get 0/1 pseudo-element, or is it possible get N>1 pseudo-elements?

For example:

  • ::before is singular - only one exists on an element.
  • ::view-transition-group() is singular if a VT name is used (because names have to be document-unique), but plural otherwise (multiple VTs can have the same VT class, or the * argument matches all VTs).
  • ::part() is always plural - the part name has the semantics of a class, and can refer to any number of elements.

We should reify this concept in Pseudo, and specify that APIs like getComputedStyle() can only refer to singular pseudos, or conditionally-singular pseudos if certain conditions are met.

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