- From: Oriol Brufau via GitHub <sysbot+gh@w3.org>
- Date: Fri, 03 Jan 2025 21:39:27 +0000
- To: public-css-archive@w3.org
Loirooriol has just created a new issue for https://github.com/w3c/csswg-drafts:
== [css-sizing] Stop preventing pseudo-elements from having a last remembered size? ==
https://drafts.csswg.org/css-sizing-4/#last-remembered
> Only elements capable of being [ResizeObserver](https://drafts.csswg.org/resize-observer-1/#resizeobserver) targets can have a [last remembered size](https://drafts.csswg.org/css-sizing-4/#last-remembered).
AFAIK the point of this sentence was to exclude pseudo-elements, since in JS you can't use `ResizeObserver` to observe pseudo-elements.
The thing is, on both Blink and WebKit, `Element` is a superclass of `PseudoElement`, so pseudo-elements are perfectly capable of being `ResizeObserver` targets, it's just that an author doesn't have access to the `PseudoElement`.
So in fact, pseudo-elements can already have a last remembered size on Blink and WebKit.
On Gecko they can't, but Gecko doesn't even use `ResizeObserver` to track the last remembered size, so the restriction seems pointless anyways.
If pseudo-elements need to be excluded it might be because their lifetime is not completely clear, but that's a completely different topic. By itself, I don't think that not being possible `ResizeObserver` targets justifies not having a last remembered size.
```html
<!DOCTYPE html>
<style>
div::before {
content: "lorem ipsum";
display: inline-block;
border: solid cyan;
contain-intrinsic-size: auto 0px;
}
div.skip-contents::before {
content-visibility: hidden;
}
</style>
<div class="skip-contents"></div>
<script>
document.body.offsetLeft;
document.querySelector("div").className = "";
requestAnimationFrame(() => requestAnimationFrame(() => {
document.querySelector("div").className = "skip-contents";
}));
</script>
```
| Gecko | Blink | WebKit |
| - | - | - |
|  |  |  |
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/11434 using your GitHub account
--
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Friday, 3 January 2025 21:39:28 UTC