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

On Sep 1, 2010, at 11:42 AM, Boris Zbarsky <bzbarsky@MIT.EDU> wrote:

> On 9/1/10 2:41 PM, Boris Zbarsky wrote:
>> On 9/1/10 2:39 PM, Lea Verou wrote:
>>> 
>>>> I must be missing something here. Say I have this rule:
>>>> 
>>>> * { width: calc(attr(border) * 10px); }
>>>> 
>>>> and this HTML document:
>>>> 
>>>> <table border=1"></table>
>>>> <div border="1"></div>
>>>> 
>>>> What are the computed widths of the div and table, and why?
>>>> 
>>>> -Boris
>>> Same as:
>>> * { width: calc(1 * 10px); }
>>> 
>>> Which if my understanding is correct ends up being equivalent to:
>>> * { width: 10px; }
>>> 
>>> Am I missing something?
>> 
>> The "width" attribute on <div> is not an integer attribute. It's just a
>> string attribute.
> 
> Er, of course I meant the "border" attribute.  But the point is that the type of an attribute depends on the node.
> 
> -Boris

Wouldn't it be reasonable to try to coerce the value into the expected type? First try to coerce into a unit, and failing that, a float or integer. 

Received on Wednesday, 1 September 2010 19:11:04 UTC