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

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 UTC