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

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

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Mon, 04 Jan 2010 20:53:45 -0500
Message-ID: <4B429BA9.60009@mit.edu>
To: divya manian <divya.manian@gmail.com>
CC: www-style list <www-style@w3.org>
On 1/4/10 8:27 PM, divya manian wrote:
> 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)?

In this case, the second <ol> is not a descendant of the first one, so 
its reset should reset the counter from the first <ol> instead of 
creating a nested one.  So yes, looks like an Opera bug.

> Also, is it ever possible to not create another instance of the
> counter

Sure. A reset only creates a new instance if there is a counter with 
that name is already in scope solely due to a reset on an ancestor or 
previous sibling of an ancestor.  A reset for a counter that's in scope 
due to a reset on a previous sibling will just reset the existing counter.

> or access only the counter value of the parent element in the
> descendant?

This I don't know, sorry.

-Boris
Received on Tuesday, 5 January 2010 01:54:20 GMT

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