[css3-lists] Opinion on the 'range' descriptor

Right now counter styles have a 'range' descriptor, which defines an
explicit range for the style.  Counter styles also have implicit
ranges based on their algorithm; for example, numeric styles have an
implicit range of [-inf,inf], while alphabetic styles have an implicit
range of [1,inf].

Hakon observed that there doesn't seem to be a good use-case for
explicit ranges on any type except additive, and I think he's probably
right.  I can only come up with a single case where it can be useful,
as an alternate way to define "fixed-width numeric" styles:

@counter-style decimal-fixed-3-1 {
  type: override decimal;
  range: 0 9;
  prefix: '00';
}

@counter-style decimal-fixed-3-2 {
  type: override decimal;
  range: 10 99;
  prefix: '0';
  fallback: decimal-fixed-3-1;
}

@counter-style decimal-fixed-3 {
  type: override decimal;
  range: 100 999;
  fallback: decimal-fixed-3-2;
}

(You then actually use the decimal-fixed-3 style in your code - the
other two are helpers only.)

(There's another slightly more hacky way to do this using alphabetic
styles and counter-reset, too.)

I don't know if this is valuable - if this particular use-case is
valuable, I'd rather support it explicitly with a numeric-fixed-width
type or something.  Are there other use-cases for an explicit range
descriptor?

~TJ

Received on Wednesday, 27 April 2011 21:53:09 UTC