W3C home > Mailing lists > Public > www-style@w3.org > December 2015

Re: [css-values] Adding a <length-percentage> production

From: Simon Pieters <simonp@opera.com>
Date: Fri, 18 Dec 2015 10:27:18 +0100
To: "www-style list" <www-style@w3.org>, "Tab Atkins Jr." <jackalmage@gmail.com>
Message-ID: <op.x9t1vsqridj3kv@simons-mbp>
On Thu, 10 Dec 2015 20:05:33 +0100, Tab Atkins Jr. <jackalmage@gmail.com>  

> At TPAC, in the unofficial Houdini meetup on Thursday, we realized
> that our property grammars were kinda ambiguous, and that was
> troublesome for the Custom Properties API.  In particular, when you
> see a grammar like "<length> | <percentage>", it's not clear whether
> the <percentage> is a distinct type, or a length-equivalent type.
> This is an important distinction, because the latter allows `calc(5px
> + 10%)`, but the former does not.  CSS has examples of both: most
> instances are the latter, but 'word-spacing' is the former, and
> 'background-position' is *technically* the former, but we hack things
> around to make it work like the latter anyway.  CSS currently resolves
> the ambiguity with prose (the "Percentages" line in the
> The solution we hit on in the meeting was to define a new grammar
> non-terminal, <length-percentage>, that indicates the
> "length-equivalent" percentage case.  This also simplifies grammars -
> I've always been slightly, vaguely annoyed at the clumsiness that "[
> <length> | <percentage> ]" introduces into my grammars, and this
> simplifies things a bit.
> We'll need similar non-terminals for the other base types: frequence,
> angle, time, and number.  I don't think we need a non-terminal for the
> length-percentage-number triplet that line-height uses - that "number"
> case probably should really have been a new unit that was a
> used-value-time 'em'.
> So, I plan to add these to V&U. Specs can gradually adopt it - the
> current grammars are non-ambiguous due to the accompanying prose.
> This is just an attempt to slightly simplify CSS, and make sure that
> Houdini and CSS grow together.
> Thoughts?

I support this. I think would be good to have the Houdini value grammar be  
a strict subset of the full CSS value grammar, and this is a step in that  

Simon Pieters
Opera Software
Received on Friday, 18 December 2015 09:27:57 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:59 UTC