Re: CSS Variables Draft Proposal

On Monday 2011-02-14 16:28 -0500, Boris Zbarsky wrote:
> Offhand, I wouldn't be willing to claim that the same string is
> always treated as the same kind of "value" in Gecko, even.  It might
> well be context-dependent.  I'm not saying that's the case; just
> that nothing ensures that it's not.

A few cases where it's not in Gecko, described mostly in terms of
the value types in http://www.w3.org/TR/CSS21/syndata.html#values
and elsewhere in CSS 2.1:

 * any integer, since we treat integers (<integer>) and floats
   (<number>) as different value types, but integers are valid
   <number>.  (And if it's a multiple of 100 in 100..900, then
   it could also be the enumerated values of 'font-weight'.  And if
   it's instead the number 0, then it could also be a <length>, or
   one of the variant type of angle that lives inside transform
   functions and allows 0.)

 * any identifier, which could be either <identifier> (as part of
   'counter-reset'/'counter-increment'),
   <family-name>/<generic-family>, or, if it's
   a color keyword, <color>.  Furthermore, keywords that are values
   for properties are essentially a different type for each
   property.

> I agree that a raw token stream may not be the right thing due to
> things like:
> 
>   @var foo 255, 255);
> 
> which could add pretty oddly if $foo is used like so:
> 
>   color: rgb(0, $foo, 0);

FWIW, what I'd want is a token stream that has balanced (), {}, and
[], and of course no ; at top-level (not within the (), {}, or []).

> >"component value" is defined in CSS2.1, at
> ><http://www.w3.org/TR/CSS21/about.html#value-defs>.  It's not exactly
> >what I want, but it appears to be closer in intent than "token".

I don't see anything close to a definition there; only some
examples.

-David

-- 
L. David Baron                                 http://dbaron.org/
Mozilla Corporation                       http://www.mozilla.com/

Received on Monday, 14 February 2011 22:03:15 UTC