Full context: https://github.com/danielsakhapov/CSSPseudoElementDoc?tab=readme-ov-file#33-plurality-multiple-pseudo-elements-of-the-same-kind
Description:
For pseudo elements like ::view-transition-old(*) / ::view-transition-new(*) (where * could match multiple captured elements with the same tag name), ::column pseudos and each can have distinct ::scroll-marker inside, how to retrieve all pseudos via Element.pseudo(type) which implies a single object per type?
Element.pseudo(type) returns the first or a representative one.
- Pros: Simple, fits the current IDL.
- Cons: Incomplete, doesn't allow access to other instances.
- Introduce
Element.pseudos(type) returning a NodeList-like collection (CSSPseudoElementList?).
- Pros: Explicitly handles plurality. Aligns with DOM patterns like
querySelectorAll.
- Cons: Adds new API. How would items in the list be uniquely identified or ordered if they are not tree-abiding?
- Parameterize potentially ambiguous pseudos, and let the parameter distinguish them (e.g. make
::column(selector)).
- Pros: Uses an existing mechanism for some cases.
- Cons: Not a general solution.
Recommendation:
We likely need an Element.pseudos(type) or a similar mechanism for pseudo elements that are inherently plural, as it's been requested by authors to e.g. add a click event listener to gather clicks statistics from every ::scroll-marker nested into ::column.
Full context: https://github.com/danielsakhapov/CSSPseudoElementDoc?tab=readme-ov-file#33-plurality-multiple-pseudo-elements-of-the-same-kind
Description:
For pseudo elements like
::view-transition-old(*)/::view-transition-new(*)(where*could match multiple captured elements with the same tag name),::columnpseudos and each can have distinct::scroll-markerinside, how to retrieve all pseudos viaElement.pseudo(type)which implies a single object per type?Element.pseudo(type)returns the first or a representative one.Element.pseudos(type)returning aNodeList-like collection (CSSPseudoElementList?).querySelectorAll.::column(selector)).Recommendation:
We likely need an
Element.pseudos(type)or a similar mechanism for pseudo elements that are inherently plural, as it's been requested by authors to e.g. add a click event listener to gather clicks statistics from every::scroll-markernested into::column.