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

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