- From: Philip Walton via GitHub <noreply@w3.org>
- Date: Wed, 02 Jul 2025 01:07:32 +0000
- To: public-css-archive@w3.org
Another use case that I recently encountered was wanting to use `IntersectionObserver` to determine when an `::after` pseudo element was fully visible in the viewport. But I couldn't do this because the `.observe()` method of `IntersectionObserver` requires an `Element`. > I don't think they can completely become first-class citizens in the DOM. Because in events, the [`target`](https://dom.spec.whatwg.org/#dom-event-target) isn't a pseudo-element, and allowing it to be a `CSSPseudoElement` seems most likely not web compatible. It's definitely not web compatible. I've seen lots of code (and written such code myself) that checks `event.target` when a user clicks on a pseudo, which would break if `event.target` stopped being the element. For example, when clicking on the `::backdrop` of a dialog, the `event.target` is the dialog element, and you can use this to implement light dismiss. I've seen this pattern several times in the wild. -- GitHub Notification of comment by philipwalton Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/11559#issuecomment-3025977457 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Wednesday, 2 July 2025 01:07:33 UTC