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

[CSS21][Core grammar] Significant whitespace

From: Simon Sapin <simon.sapin@kozea.fr>
Date: Tue, 21 Feb 2012 02:35:08 +0100
Message-ID: <4F42F4CC.3000204@kozea.fr>
To: "www-style@w3.org" <www-style@w3.org>
Hi,

I am in the process of writing a "future proof" parser for CSS. The idea 
is to separate the core grammar from stuff defined in CSS 2.1 or various 
CSS 3 modules, so that it is easy to add syntax from such modules.

White space can appear at a lot of places in the core grammar, and some 
of it is significant. For example, the selector 'a [href]' has a 
descendant combinator and is different from 'a[href]'.

However, most white space is *not* significant and can be safely removed 
while parsing the core gramma. For example between statements or between 
declarations.

What about white space inside the value for a declaration? The 'value' 
field for any property that I can find never lists white space. But is 
there a design principle that I can rely on saying that white space in 
any property value will never be significant like it is in selectors? 
(Other than for separating tokens.)

If there is no such principle, white space needs to be handled while 
parsing the value for each individual property.

For example, there has been suggestions of accessing individual items in 
"lists" like font-family or transforms.
If a value like "font-family[4]" becomes legal, will it be the same as 
"font-family [4]" or will white space become significant?

Thanks,
-- 
Simon Sapin
Received on Tuesday, 21 February 2012 01:35:36 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:50 GMT