Re: [css3-values] percentage in calc() and attr()

> On 04 May 2016, at 10:46, Yves Lafon <ylafon@w3.org> wrote:
> 
> In https://drafts.csswg.org/css-values/#attr-notation
> the <type-or-unit> definition has this for percentage:
> [
> ‘%’, A keyword matching one of the <length>, <angle>, <time>, or <frequency> units
> ]
> In https://drafts.csswg.org/css-values/#calc-type-checking
> [
> If percentages are accepted in the context in which the expression is placed, a <percentage-token> has the type of the value that percentages are relative to; otherwise, a math expression containing percentages is invalid.
> ]
> does it imply that it can be used only in those cases ? (like width: attr(foo %)  of width: calc(10% / 3) )
> 
> ie: is color: rgb(attr(foo %), calc(attr(bar %) + 10% ), 45); allowed ?
> 
> There is an example in the spec using hsl, but no assertion on its validity.
> Some clarification in the spec would be useful.
> 
> (Note that if in the color case % resolves to number, then the attr() definition is wrong unless attr() is forbidden here.
> Thanks,

As a followup, I made a small test using 

        background-color: rgb(calc(10% + 40%), calc(100% / 2), calc(25% * 2));

Safari 9.1 (11601.5.17.1) and Chrome  51.0.2704.29 handle well that definition, but not Firefox 49.0a1 (2016-05-03)

-- 
Baroula que barouleras, au tiéu toujou t'entourneras.

        ~~Yves

Received on Wednesday, 4 May 2016 11:12:39 UTC