W3C home > Mailing lists > Public > www-style@w3.org > August 2012

[css-counters] Counters not in scope scope

From: Elliott Sprehn <esprehn@gmail.com>
Date: Thu, 16 Aug 2012 11:49:50 -0700
Message-ID: <CAPJYB1hEDKDfx4JomQkZ4XJ7f7mmu44za78RvpY8vzvaVF6Uwg@mail.gmail.com>
To: www-style list <www-style@w3.org>
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 GMT

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