W3C home > Mailing lists > Public > www-style@w3.org > February 2013

Re: [css-syntax] value grammar, <value> type and browser implementations

From: L. David Baron <dbaron@dbaron.org>
Date: Tue, 5 Feb 2013 20:21:51 -0700
To: François REMY <francois.remy.dev@outlook.com>
Cc: "Tab Atkins Jr." <jackalmage@gmail.com>, www-style list <www-style@w3.org>
Message-ID: <20130206032151.GB10481@crum.dbaron.org>
On Tuesday 2013-02-05 16:17 +0100, François REMY wrote:
> > The use of the value production from 2.1 isn't desirable in any case.
> > What we actually want to do is simply say that it has no grammar -
> > that every possible property value is valid for a custom property.
> > That way, the only limitation is what is automatically imposed by the
> > parser itself.
> My issue is that browsers do not seem to follow any spec for their property value syntax (because the CSS Syntax is more permissive than any non-custom property need, and inexplicably complex).
> The 'value' grammar doesn't make any sense to me: it seem to accept {a:a} but not {'a':'a'} or {a}. It should accept [;;] but not {;;}. I would like the value tokenization to be redefined to be more understandable and independant of other productions like 'block', 'declaration' and 'property'.

So I think Tab and François are arguing for opposite things here
(despite Tab thinking they're agreeing).  I think Tab is arguing for
fewer restrictions on the value syntax (for reasons I don't
understand), and François is arguing for more restrictions (I think
because there are parts of the current value space that aren't
correctly handled by the forward-compatible parsing code in some
existing implementations).

I think the main argument for wanting a loose syntax is that there's
less to validate during the initial parsing (and finding the extent
of the variable).  I believe that with the current grammar, all the
implementation needs to do is track (), [], and {}, and:
 * check that they are balanced
 * when the stack is empty, look for ; and } as a terminator
 * when the stack is empty, reject CDO and CDC (though I proposed
   right after the end of today's meeting, and in
   http://lists.w3.org/Archives/Public/www-style/2013Feb/0196.html ,
   that we eliminate this).

Adding a more restrictive value syntax might mean more work.  If
perhaps the proposal is simply to disallow '{' and '}' either
anywhere within the value or at top-level, then it's probably only
more work at the specification level and not at the implementation
level, at least for implementations based on a recursive descent
parser like Gecko's.


𝄞   L. David Baron                         http://dbaron.org/   𝄂
𝄢   Mozilla                           http://www.mozilla.org/   𝄂
Received on Wednesday, 6 February 2013 03:22:16 UTC

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