CSS 2.1: counter-reset in :before elements

I recently had a bug report from a person who had used the examples presented 
in the CSS 2.1 specification. The problem is that I consider our current 
behaviour correct and it also matches the behaviour of Opera.

The issue regards counter-reset in :before elements such as this (taken from 
the CSS 2.1 specification):
H1:before {
    content: "Chapter " counter(chapter) ". ";
    counter-increment: chapter;  /* Add 1 to chapter */
    counter-reset: section;      /* Set section to 0 */
}
H2:before {
    content: counter(chapter) "." counter(section) " ";
    counter-increment: section;
}

The problem is the nesting rules and the status of pseudo elements. The 
nesting rules state that a counter-reset creates a new instance of the 
counter for its later siblings and children, and the pseudo elements are 
usually treated as children. This combined means that a counter-reset in 
a :before element only affects the children of the element.

So is the example wrong, or is Konqueror and Opera wrong in our implementation 
of counters?

`Allan

Received on Thursday, 7 April 2005 21:48:46 UTC