W3C home > Mailing lists > Public > www-style@w3.org > January 2010

Re: Counter-reset on pseudo class creates new counter-scope

From: divya manian <divya.manian@gmail.com>
Date: Mon, 4 Jan 2010 17:27:10 -0800
Message-ID: <40fb5ba21001041727t14749e3bi69ae7ff603b57a98@mail.gmail.com>
To: Boris Zbarsky <bzbarsky@mit.edu>
Cc: www-style list <www-style@w3.org>
On Mon, Jan 4, 2010 at 11:13 AM, Boris Zbarsky <bzbarsky@mit.edu> wrote:

> The Webkit behavior of resetting that counter to the value 1 is incorrect
> per the current spec text; note, however, that the spec here changed at some
> point in the last few years.  It may be that Webkit implements an earlier
> version.

Thanks. I will check on Webkit bug tracker.

> I don't know where you got your Opera result from.  Opera 10 shows the same
> thing as Gecko over here.

I am sorry, seems like I was mistaken.

> That's what the spec requires, yes.  In particular this part:
>
>  "resetting a counter in a descendant element or pseudo-element
>   automatically creates a new instance of the counter."
>
> In this case, resetting the counter on the <li> (the pseudo-class doesn't
> matter except insofar as it resets the counter on a particular <li>) creates
> a new instance of the counter, since the in-scope instance at that point is
> on the parent of the <li>.
>

OK. I understand this now. Opera rendering is different from
Webkit/Firefox when a pseudo-classes of <ol> element overrides an
earlier declaration:

ol { counter-reset: list-order; }

ol:nth-of-type(2) { counter-reset: list-order 3; }

The example (altered an example from the Opera article on counters [1]):

http://nimbupani.com/demo/counters-start-example.html

Should I assume this is incorrect interpretation of the spec by Opera
(since it seems to reset the counter on a pseudo-class rather than a
pseudo-element or descendant)?

Also, is it ever possible to not create another instance of the
counter, or access only the counter value of the parent element in the
descendant?

Regards,
Divya

[1] http://dev.opera.com/articles/view/automatic-numbering-with-css-counters/
Received on Tuesday, 5 January 2010 01:27:43 GMT

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