On Thu, Jul 24, 2008 at 1:28 PM, Ludger Buenger <
ludger.buenger@realobjects.com> wrote:
> What I am missing is a way to set a counter to a specific value while
> maintaining the current scope.
>
>
>
> I believe this is problematic because there are use cases where you do not
> intend to open a new scope when setting a counter value â€“ I mentioned a use
> case as an example.
>
>
>
> And this is not a paged media issue - I do also have others use cases at
> hand which do not involve paged media at all.
>
Keep in mind, though, exactly what scope refers to. [1] When you do a
counter-reset, it establishes a new scope which encompasses the element,
it's children, *and it's siblings*. Frex, say you made your own special
form of list called ordl, and had code/style set up like this:
ordl {
margin-left: 1em;
display: block;
border-top: thin solid black;
}
ordl[reset] {
counter-reset: ordl-item;
}
listi {
display: block;
}
listi::before {
content: counter( ordl-item ) ": ";
counter-increment: ordl-item;
}
<ordl reset>
<listi>one</listi>
<listi>two</listi>
<listi>
<ordl>
<listi>three</listi>
<listi>four</listi>
</ordl>
</listi>
<listi>
<ordl reset>
<listi>five</listi>
<listi>six</listi>
</orld>
<ordl>
<listi>seven</listi>
<listi>eight</listi>
</orld>
</listi>
<listi>nine</listi>
</ordl>
You'd produce an output looking like this:
________
1: one
2: two
3:
_______
4: three
5: four
6:
_______
1: five
2: six
_______
3: seven
4: eight
7: nine
(I included the border-top just so it was clear that the
five-six-seven-eight was from two different <ordl>s.)
So, this aspect of scope covers a lot of use cases. Specifically, it allows
you to reset something and have that reset affect later siblings. The only
thing that scoping does is prevent an element from resetting it's *parent's*
counter. Do you have a usecase that requires this? (Not that I doubt you,
I'm just curious.)
~TJ