Re: [csswg-drafts] [css-pseudo] Can we make pseudo-elements first-class citizens in the DOM? (#11559)

> But [[CSSPseudoElement]](https://drafts.csswg.org/css-pseudo-4/#CSSPseudoElement-interface) is specced to extend EventTarget, which would make it work?

This would add support for `addEventListener`. But consider

```js
document.addEventListener("mousemove", e => console.log(e.target))
```

When you move the mouse over `#foo::before`, you get an event where the `target` is the `#foo` element, not the pseudo-element.

Turning `CSSPseudoElement` into a `EventTarget` doesn't automatically change that, and changing that doesn't seem web compatible.

-- 
GitHub Notification of comment by Loirooriol
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/11559#issuecomment-2609979466 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Thursday, 23 January 2025 14:38:36 UTC