Re: [csswg-drafts] [cssom] `ComputedStyleObserver` to observe changes in elements' computed styles (#8982)

> Surprised this doesn't work in Safari 18, given that it supports allow-discrete.

It‘s debatable because the _computed_ value of `content` doesn’t actually change here; it remains empty. Changing `content` directly contain a (quoted) `<string>` – `setPropertyValue('content', `"${randomString()}"`) – makes the transition event fire.

(I don’t know whether a transition event should fire when the inputs change, or only when the output changes. If it’s the former, then it’s a WebKit bug)

---

Circling back, I tried [another approach](https://codepen.io/bramus/pen/ExBpdXb): directly transition the custom properties with `allow-discrete`.

```
html {
 transition: --observed 0.001ms step-start, --hover 0.001ms step-start;
 transition-behavior: allow-discrete;
}
```

While this works in Safari Technology Preview (yay!) it only partially works in Firefox (the `--hover` doesn’t trigger a style recalc when hovering the `h1`) and doesn’t work in Chrome at all (which could be circumvented by adding `all` and `content` back in the game.

I’ve got bugs to file …

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


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

Received on Thursday, 29 August 2024 12:14:05 UTC