Re: [csswg-drafts] [selectors-4] additional resource state pseudo-classes for img / picture elements (#7467)

I've been thinking a bit more about @Crissov's proposal and on second thoughts it does seem that a lot of those are redundant and can be subsumed into `:broken`. My suggestion would be the following:

- `:pending` – lazy-loaded images that have not yet started to load because the browser does not yet estimate that they will be needed
- `:loading` – a request has been sent, and has not errored or loaded
- `:stalled` –  the image is loading but has failed to receive data for some amount of time, but not failed. `:loading` will also match whenever `:stalled` matches. This pseudo-class is already used for video
- `:broken` – the request for the image has failed, whether from a HTTP error or timeout, or the image can't be used for some reason such as corrupt data. This would probably be when the `error` event has fired.
- `:loaded` – the image has sucessfully loaded. This would be when the `load` event has fired.

I don't know if there should be an additional `:complete` pseudo-class that would match both `:broken` and `:loaded`.

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


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

Received on Friday, 5 September 2025 05:55:34 UTC