How to target the parent of selected text? Any workaround for ":has(::selection)"

I know, :has() does not work with pseudo-elements, but I like to style an element if it has parts of it selected. Just like :has(::selection) would do. Currently I am running a selectionchange handler on the document and check the list of parent candidates and attach a class "manually". But this should be doable with a css rule, right? Is there any workaround? Or is this planned to be implemented by the browsers?
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server