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

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