W3C home > Mailing lists > Public > www-style@w3.org > December 2011

Re: [css3-lists] counters "self-nesting"

From: Andrian Cucu <acucu@adobe.com>
Date: Fri, 9 Dec 2011 11:48:14 +0000
To: Simon Sapin <simon.sapin@kozea.fr>, "www-style@w3.org" <www-style@w3.org>
Message-ID: <CB07C0B9.10ADB%acucu@adobe.com>
Hi,

In that case, I find the wording "re-using a counter in a child element
automatically creates a new instance of a counter" confusing - since I'm
reusing the same counter in a child element and thus a new instance of the
counter should be created.

At the same time, my interpretation is that "a new instance of a counter"
means a new counter scope - or does instance refer to something else?

Thanks,

-Andrian

On 12/9/11 12:15 PM, "Simon Sapin" <simon.sapin@kozea.fr> wrote:

>Le 08/12/2011 15:24, Andrian Cucu a écrit :
>> The following statement is used, in section 8.1. on nested counters and
>> scope, to describe "self-nesting":
>> /Counters are "self-nesting", in the sense that re-using a counter in a
>> child element automatically creates a new instance of the counter./
>> /
>> /
>> Does this mean that the following snippet should create 2 counter
>> instances and thus it should render (1) and (1)?
>> <style>
>> div {
>> counter-increment: div-count;
>> }
>> div:before
>> {
>> content: "(" counter(div-count) ") ";
>> }
>> </style>
>> <div>
>> <div>
>> </div>
>> </div>
>>
>> Currently user agents display (1) and (2) for this snippet.
>
>Hi,
>
>As described later in the same section, the counter-increment on your
>first div is for a counter that is not in scope, so a new scope/instance
>is created for it. The second div however is in the scope that was just
>created, so counter-increment does not create a new scope.
>
>If you had specified counter-reset as well as counter-increment, both
>resets would have create a scope each and UAs would render (1) and (1).
>
>Regards,
>-- 
>Simon Sapin
>
Received on Friday, 9 December 2011 11:49:17 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:47 GMT