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

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

From: Simon Sapin <simon.sapin@kozea.fr>
Date: Fri, 09 Dec 2011 11:15:05 +0100
Message-ID: <4EE1DFA9.5010403@kozea.fr>
To: www-style@w3.org
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 10:15:56 GMT

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