Re: [css3-values] types and where attr() and calc() can be used

(12/04/12 1:36), Tab Atkins Jr. wrote:
> On Wed, Apr 11, 2012 at 5:36 AM, Kang-Hao (Kenny) Lu
> <kennyluck@csail.mit.edu> wrote:
>> The attr() section says
>>
>>  # If the type is not valid for where the ‘attr()’ expression is
>>  # placed, the whole ‘attr()’ expression is invalid.
>>
>> , and my interpretation of this sentence is that 'attr(<wqname>
>> integer)' cannot be used where <number> is expected. (This
>> interpretation might not match the intention of the person who wrote
>> this prose, but if that's the case I request this vagueness be
>> clarified. )
> 
> This is already handled - the definition of the <number> type says
> "either an integer, or ...".  So an <integer> is a <number>.

Then, as I said, I would like to request this be clarified. I swear I
didn't intend to come up with an interpretation that's just wrong (or
why did I write this long?). This is how I interpret the above sentence,
and of course, I did read the "either an integer, or ..." part.

>> The section of 'calc()' says
>>
>>  # It can be used wherever <length>, <frequency>, <angle>, <time>, or
>>  # <number> values are allowed.
>>
>> It seems that <integer> is intentionally left out. Why? If the reason is
>> "lack of use cases" then that applies to <number> too, I think.
> 
> Same as above - integer is defined as a subtype of number.

No, this is different. If 'calc()' can used at where <integer> is
expected, does

  # The value resulting from an expression must be clamped to the range
  # allowed in the target context.

mean the value is truncated? Specifically, what is the result of

data:text/html,<style>:root::before { counter-reset: x calc(0.5);
content: counter(x);}</style> (unprefixed)

? I should note that both Firefox14a and IE9 drop these at the moment.

>>  * as an argument to rgb() or rgba() (attr(), calc(). Does this make
>> sense?)
> 
> There's no reason to disallow either of these.

I should note that the first three arguments of either rgb() or rgba()
are of the <integer> type, so this depends on the above question.

> attr() can't be used in url() - "url(attr(foo))" parses as
> "baduri1:url(attr LEFT-PAREN IDENT RIGHT-PAREN RIGH-PAREN".  We can't
> ever use *anything* in url() because of the parsing rules.  url() is
> *fucked up*.

This is relavant to [1] so I'll prefer we follow up there.


[1] http://lists.w3.org/Archives/Public/www-style/2012Apr/0152


Cheers,
Kenny

Received on Wednesday, 11 April 2012 18:24:08 UTC