Re: [CSS2.1] Why is counter incremented before it's used?

On Wed, Jan 11, 2012 at 12:20 PM, Jack Smiley <zxcv_890@hotmail.com> wrote:
> Why was the decision made to increment a counter before it's used? Doesn't
> it then make it more confusing to have to set the counter to one less than
> the desired starting number? Then again, you guys are very smart, so I'm
> guessing there's probably a good reason...

Because if you don't, then you can't vary the amount you're
incrementing by according to the element - you'd have to *predict*
what the next element wants to increment by in whatever the previous
element that touches that counter is.

It also just generally seems more intuitive that counter-increment on
an element affects the value of the counter *on that element*.  It
does lead to the slightly inconvenient fact that you need to set
counter-reset to one less than your desired first value, as you note,
but you have to choose whether to make -increment confusing, or
-reset.  My previous paragraph makes it clearer why -increment won.

~TJ

Received on Wednesday, 11 January 2012 20:54:52 UTC