Re: [mediaqueries] calc() and other syntax restrictions (was: Re: Validating media queries in Java)

On Sat, May 4, 2013 at 11:05 PM, Simon Sapin <simon.sapin@exyr.org> wrote:
> Le 02/05/2013 21:46, fantasai a écrit :
>>>
>>> Gunther: Don't worry, whatever conclusions that that old thread may
>>> have come to, calc() is definitely allowed in Media Queries, at least
>>> per spec.  (calc() is allowed*everywhere*, because it's just a
>>>
>>> fill-in for its resolved type.)
>>
>> I am not so sure about that, and if that's our intent I think it could
>> definitely use some clarification.
>
>
> I agree with Tab. Whether or not this was originally intended, calc() is
> allowed in Media Queries per spec.
>
> css3-mediaqueries:
>
>> Whitespace, <integer>, <number> and other values used by this
>> specification are the same as in other parts of CSS, normatively
>> defined by CSS 2.1. [CSS21]
>
>
> css3-values:
>
>> The ‘calc()’ expression […] can be used wherever <length>,
>> <frequency>, <angle>, <time>, <number>, or <integer> values are
>> allowed.
>
>
> For comparison, attr() is not allowed in MQs. css3-values:
>
>> The attr() function is allowed as a component value in properties
>> applied to an element or pseudo-element.

Yup, this is what I was referring to when I said it was "allowed
everywhere, because it's just a fill-in for its resolved type".

> That said, I’m always in favor of clarification in specs. And calc() is
> indeed not very useful in MQs, since eg. the em unit is based on the initial
> font-size and not one from a stylesheet.

The initial font-size isn't a known value - it's influenced by the
user's default font size.

> Oh, and while we’re on conclusions of that old thread, I think that
> micro-syntaxes like MQs and Selectors should definitely use an actual CSS
> parser, up to what Syntax 3 calls "component values". This takes care of
> escaping, block/paren nesting and error recovery rules.

Yes, I need to finish up Syntax.  I'll have this ready before the June meeting.

~TJ

Received on Monday, 6 May 2013 17:13:11 UTC