W3C home > Mailing lists > Public > public-css-archive@w3.org > February 2018

[csswg-drafts] [css-lists] Does counter() create a new counter if none exists?

From: Oriol Brufau via GitHub <sysbot+gh@w3.org>
Date: Thu, 22 Feb 2018 18:39:46 +0000
To: public-css-archive@w3.org
Message-ID: <issues.opened-299462901-1519324785-sysbot+gh@w3.org>
Loirooriol has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-lists] Does counter() create a new counter if none exists? ==
Consider this code: https://jsfiddle.net/35kuzg5m/

```html
<div>
  <p>aaa</p>
  <p>bbb</p>
</div>
<hr />
<div>
  <p>aaa</p>
  <p>bbb</p>
</div>
```

```css
p::before {
  content: counter(c) '/ ';
  counter-increment: c 1;
}
div ~ div::before {
  content: counter(c, none);
}
```

It's rendered as:

| Firefox and Chrome  | Edge                |
| ------------------- | ------------------- |
| 1/ aaa<br />1/ bbb  | 1/ aaa<br />1/ bbb  |
| 1/ aaa<br />2/ bbb  | 1/ aaa<br />1/ bbb  |

In https://drafts.csswg.org/css-lists/#counter-functions I can't find anything that says that `counter()` can [create a new counter](https://drafts.csswg.org/css-lists/#create-a-new-counter), so it seems Edge is the only one that follows it.

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/2348 using your GitHub account
Received on Thursday, 22 February 2018 18:39:51 UTC

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