W3C home > Mailing lists > Public > www-style@w3.org > September 2010

Re: [css3-values] Suggestion: Allowing attr() in calc()

From: Lea Verou <leaverou@gmail.com>
Date: Wed, 01 Sep 2010 22:52:22 +0300
Message-ID: <4C7EAEF6.3020603@gmail.com>
To: Boris Zbarsky <bzbarsky@MIT.EDU>
CC: www-style@w3.org

> On 9/1/10 3:26 PM, Lea Verou wrote:
>>> The second argument (which is optional but must be present if the
>>> third argument is present) is a <type> and tells the UA how to
>>> interpret the attribute value. It may be one of the values from the
>>> list below.
>> (from http://dev.w3.org/csswg/css3-values/#ltattrgt)
> Ah.  That sounds unfortunately slow, but ok.
>> So what I'm saying is that if the type of the attribute as defined in
>> the markup spec (or if it's not defined at all) is "string", and attr()
>> is called on it without a 2nd parameter, then it could either be
>> considered a parse error (which would be more consistent with how attr()
>> is currently proposed) or interpreted as a number, if possible (which is
>> more useful).
> With some sort of fallback for values that can't be interpreted as numbers?
That's what the 3rd argument of attr() does: :)
> The third argument (which is optional) is a CSS value which must be valid where the attr() expression is placed. If it is not valid, then the whole attr() expression is invalid.
> If the attribute named by the first argument is missing, cannot be parsed, or is invalid for the property, then the value returned by attr() will be the third argument, or, if the third argument is absent, will be the value given as the default for the relevant type in the list below.

>> Am I making sense now?
> Yes, but I'm not sure what the use cases are, honestly...
I provided one in my original post. I can provide others too, if needed. :)
> -Boris

Lea Verou
Blog: leaverou.me <http://leaverou.me>
Twitter: http://twitter.com/LeaVerou
LinkedIn: http://gr.linkedin.com/in/leaverou
Received on Wednesday, 1 September 2010 19:53:58 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:49:47 UTC