[css-counters] Counters not in scope scope

I'm trying to fix and clean up the counter implementation in WebKit
and came across some confusion in the spec:

http://www.w3.org/TR/CSS21/generate.html#scope
"""
If 'counter-increment' or 'content' on an element or pseudo-element
refers to a counter that is not in the scope of any 'counter-reset',
implementations should behave as though a 'counter-reset' had reset
the counter to 0 on that element or pseudo-element.
"""

To me this reads that every counter-increment or content: counter(x);
when there's no scope should reset to 0 so given this example
http://jsfiddle.net/mLUyP/ you should output all (1)'s since there's
no counter-reset in the document. Instead WebKit and Gecko output
(1)(2)(3) twice like the first counter-increment implies a
counter-reset to 0 *and* establishes a new scope.

Opera's behavior here is totally different:
http://test.csswg.org/suites/css2.1/20110323/html4/counters-scope-implied-002.htm

Is there a reason for the implied scopes? Why not just reset every
counter to 0 at the document root?

- Elliott

Received on Thursday, 16 August 2012 18:50:48 UTC