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

Re: [css-syntax][css-variables] parsing a declaration should allow white space only values

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Mon, 9 Dec 2013 21:23:11 +1100
Message-ID: <CAAWBYDDxUhYEOd2vALYgbtibC_n=Xhj9ErC3MfcAJ04M4MaRvg@mail.gmail.com>
To: Simon Sapin <simon.sapin@exyr.org>
Cc: www-style list <www-style@w3.org>
On Mon, Dec 9, 2013 at 8:57 PM, Simon Sapin <simon.sapin@exyr.org> wrote:
> On 09/12/2013 03:58, Cameron McCormack wrote:
>> CSS Variables allows custom properties to have a value that consists
>> only of a white space token, such as |var-a: ;|.  The "parse a
>> declaration" algorithm in
>> http://dev.w3.org/csswg/css-syntax/#parse-a-declaration doesn't, however.
>
> But with or without this fix, I believe that Parse a declaration does accept
> |var-a: ;|. What makes you think it doesn’t?

Yeah, the steps are:

1. Consume the next input token.

2. While the current input token is a <whitespace-token>, consume the
next input token.

3. If the current input token is anything other than a <colon-token>,
this is a parse error. Return nothing.
Otherwise, consume the next input token.

4. While the current input token is anything other than an
<EOF-token>, append it to the declaration’s value and consume the next
input token.

5. If the last two non-<whitespace-token>s in the declaration’s value
are a <delim-token> with the value "!" followed by an <ident-token>
with a value that is an ASCII case-insensitive match for "important",
remove them from the declaration’s value and set the declaration’s
important flag to true.

6. Return the declaration.

The relevant parts are steps 4-6, which definitely allow a declaration
to validly contain just whitespace or nothing at all.

~TJ
Received on Monday, 9 December 2013 10:23:58 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:39:17 UTC