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

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

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Wed, 11 Apr 2012 12:42:11 -0700
Message-ID: <CAAWBYDBEwTJyGUOg7X-c-6Q0sxn5LBv7ugNdHx+9P90siSeCVw@mail.gmail.com>
To: "Kang-Hao (Kenny) Lu" <kennyluck@csail.mit.edu>
Cc: WWW Style <www-style@w3.org>
On Wed, Apr 11, 2012 at 11:23 AM, Kang-Hao (Kenny) Lu
<kennyluck@csail.mit.edu> wrote:
> (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.

I can try to put a note somewhere or something, but I'm not sure how
much clearer I can make it than "a number is an integer or this other

>>> 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.

Oh!  I understand now.  Yes, this is a problem.  Hm.  Logged.

(Luckily, the calculation necessary to tell if a calc() returns an
integer is basically the same as determining if a divide-by-0 happens,
or what the resolved type is.)

>> 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

Ah, indeed.  Of course, saying "you can only use attr() in url() if
you escape at least one of the letter in 'url'" is pretty confusing.

Let's follow up in that other thread.

Received on Wednesday, 11 April 2012 19:43:04 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 11 February 2015 12:35:07 UTC