- From: andruud via GitHub <sysbot+gh@w3.org>
- Date: Tue, 05 Nov 2024 13:23:13 +0000
- To: public-css-archive@w3.org
> I’d like to get some implementer feedback on the feasibility of doing this [tracking applied decls] in current engines.
Generally, this sounds hard and expensive. However:
If instead of "applied", we track which atomic declarations _lose the cascade_, then it might be feasible. During cascading, we could make a note whenever an atomic declaration got overwritten by something, and use this in the apply step to filter out other declarations from the same `@atomic` rule.
Note that a `revert-layer` (and `revert`) declaration would need to count as overwriting a declaration. Example: the declarations within `@atomic` are not applied in this case, because `--x: 1` was overwritten by something:
```
@layer {
@atomic {
--x: 1;
--y: 1;
}
}
@layer {
--x: revert-layer;
}
```
This is because `revert-layer` (and `revert`) are computed-value time effects, despite what it sounds like in current specs. This follows from the requirement that `var(--unknown, revert-layer)` behaves as `revert-layer`, which can't be known until substitution (AKA computed-value time).
> My main worry is circularities: I can't yet see any, but I have an annoying niggling feeling that they may exist.
I _think_ with the above behavior, the worst that can happen is all rules in the "cycle" end up not applying. Example from @sesse (which would be circular, if we spec `@atomic` hazardously):
```
@atomic {
div {
color: red !important;
background-color: white; /* loses */
}
}
@atomic {
div {
color: white; /* loses */
background-color: black !important;
}
}
```
Since both `@atomic` rules have losses, neither are applied.
--
GitHub Notification of comment by andruud
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/11142#issuecomment-2457174881 using your GitHub account
--
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Tuesday, 5 November 2024 13:23:14 UTC