- From: triple-underscore via GitHub <sysbot+gh@w3.org>
- Date: Wed, 18 Nov 2020 01:03:49 +0000
- To: public-css-archive@w3.org
The updated [inherit counters algorithm](https://drafts.csswg.org/css-lists-3/#inherit-counters) by [this commit](https://github.com/w3c/csswg-drafts/commit/ad9a4bc6e6397b6fb66721828e66eb84e73a0c4f) would not produce correct result in certain cases, because it makes elements not inherit a nested counter instantiated by any preceding sibling, due to step 3 of the algorithm:
> Let sibling counters be the CSS counters set of element’s preceding sibling (if it has one), or an empty CSS counters set otherwise.
> For each counter of sibling counters, if element counters does not already contain a counter with the same name, append a copy of counter to element counters.
So, for the following case (no increment), for example:
```
div::before {
content: "(" counters(foo,'.') ")";
}
<div style="counter-reset: foo">
<div style="counter-reset: foo"></div>
<div></div>
</div>
```
According to the algorithm, If my interpretation is correct, the second inner div will only inherit it's parent's counters named `foo`, but ignores the same named nested counter instantiated by the first inner div, and it would produce:
```
(0)
(0.0)
(0)
```
But browsers renders this as:
```
(0)
(0.0)
(0.0)
```
--
GitHub Notification of comment by triple-underscore
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/5477#issuecomment-729308876 using your GitHub account
--
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Wednesday, 18 November 2020 01:03:51 UTC