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

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

From: Jack Smiley <zxcv_890@hotmail.com>
Date: Wed, 11 Jan 2012 14:47:19 -0800
Message-ID: <SNT106-W15D9340087707C3958568FB69E0@phx.gbl>
To: <jackalmage@gmail.com>
CC: <www-style@w3.org>

Yes, I thought there was good reason... I just wish I could understand it! Would you (or another list member) be so kind as to flesh out this explanation a bit?

> From: jackalmage@gmail.com
> Date: Wed, 11 Jan 2012 12:53:56 -0800
> Subject: Re: [CSS2.1] Why is counter incremented before it's used?
> To: zxcv_890@hotmail.com
> CC: www-style@w3.org
> 
> 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 22:50:16 GMT

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