W3C home > Mailing lists > Public > public-css-archive@w3.org > October 2017

[csswg-drafts] [css-lists][css-values] Get a counter value as an integer

From: Oriol Brufau via GitHub <sysbot+gh@w3.org>
Date: Sun, 15 Oct 2017 15:03:44 +0000
To: public-css-archive@w3.org
Message-ID: <issues.opened-265578512-1508079808-sysbot+gh@w3.org>
Loirooriol has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-lists][css-values] Get a counter value as an integer ==
As said in https://github.com/w3c/csswg-drafts/issues/1869#issuecomment-336650532, it would be useful if there was a way to obtain the numerical value of a counter.

One possibility would be modifying the syntax of [`counter()`](https://drafts.csswg.org/css-lists/#counter-functions) to something like [`attr()`](https://drafts.csswg.org/css-values/#attr-notation)'s

```
counter()  =  counter( <ident> <type>?, [ <counter-style> | none ]? )
<type>     =  string | integer
```

If `<type>` is `integer`, then `counter()` represents an `<integer>` (the 2nd argument is ignored) and can be used anywhere that accepts an `<integer>`. If `<type>` is `string`, `counter()` represents a `<string>` (according to the 2nd argument) and can be used anywhere that accepts a `<string>`. 	If omitted, `string` is implied.

Another possibility would be adding a new function, e.g.

```
counter-value()  =  counter-value( <ident> )
```

`counter-value()` represents an `<integer>` and can be used anywhere that accepts an `<integer>`.

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/1871 using your GitHub account
Received on Sunday, 15 October 2017 15:03:31 UTC

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