W3C home > Mailing lists > Public > public-css-archive@w3.org > July 2019

[csswg-drafts] [css-lists-3] counter(name, none) should be invalid (#4163)

From: fantasai via GitHub <sysbot+gh@w3.org>
Date: Wed, 31 Jul 2019 19:04:41 +0000
To: public-css-archive@w3.org
Message-ID: <issues.opened-475308099-1564599879-sysbot+gh@w3.org>
fantasai has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-lists-3] counter(name, none) should be invalid ==
In CSS2, `counter(name, none)` and `counters(name, "string", none)` were both invalid, as `none` was not allowed in `counters()`. See [definition of counter functions in CSS2](https://www.w3.org/TR/CSS2/generate.html#propdef-content)

In the [CSS Lists Level 3 drafts](https://www.w3.org/TR/2019/WD-css-lists-3-20190425/), it was allowed, but it caused the function to return the empty string.

Meanwhile, in Chrome and Firefox, `none` is valid, and it represents a counter style that returns the empty string (which in `counters()`, is not the same thing as simply returning the empty string). [testcase](http://software.hixie.ch/utilities/js/live-dom-viewer/?%3Cstyle%3E%0Adiv%20%7B%20counter-reset%3A%20test%3B%20%7D%0A%23test%3A%3Abefore%20%7B%20content%3A%20%22A%22%20counters(test%2C%20%22%2C%22%2C%20none)%3B%20%7D%0A%3C%2Fstyle%3E%0A%3Cdiv%3E%3Cdiv%3E%3Cdiv%3E%3Cdiv%20id%3Dtest%3EB)

Wrt the css-lists-3 behavior, I can't think of any use case. If you want the empty string, you can just write `""`. As for the behavior implemented in Chrome and Firefox for counters(), it seems really odd, as it just generates a series of (n-1) strings for a counter nesting depth of n?

I'm updating the css-lists-3 spec to match CSS2, because that's our reference spec for these features and we're supposed to sync with it. Filing this issue to track that and in case anyone wants to argue for matching Chrome & Firefox.

CC @MatsPalmgren @dbaron @tabatkins @jensimmons @LeaVerou 

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/4163 using your GitHub account
Received on Wednesday, 31 July 2019 19:04:43 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 5 July 2022 06:41:50 UTC