Open
Description
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 aNodeList
-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?
- Pros: Explicitly handles plurality. Aligns with DOM patterns like
- 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
.