Re: CSS Parsed Unambiguously

Chris Ridpath asked if CSS stylesheets need to be valid to pass SC 4.1.1.
"Valid stylesheet" is defined at 
http://www.w3.org/TR/1998/REC-CSS2-19980512/conform.html#x11
but is validity necessary for ambiguous parsing?


At 16:57 10/06/2006,Tim Boland wrote:
<blockquote>
The behavior of a CSS stylesheet should be well-defined in all cases,
according to the applicable CSS specification.

A CSS stylesheet should be valid if it does not have syntax errors or grammar
errors, uses the vocabulary correctly, and meets any other conformance
requirements, as defined by the applicable CSS specification.
<blockquote>

As far as I can tell, there are several levels of "correctness" for CSS.

1. The first requirement for a valid CSS2 style is that is "written 
according to the grammar of CSS2."
If this requirement is met, the syntax can be "parsed unambiguously".
However, this grammar defines a sort of superset of CSS2: it does not 
express certain semantic constraints that are imposed by the CSS 2 
specification. This is meant to ensure that conforming user agents can 
still parser CSS style sheets containing rules and style declarations (e.g. 
CSS 3 style sheets) that did not exist when the user agent was created.
If the baseline of a website contains CSS2, these newer rules and style 
declarations must not be "relied upon": they are outside the baseline. But 
if the stylesheet is written according to the grammar of CSS, it still 
parses unambiguously at some level.
(The W3C CSS validator does much more than checking the grammar.)

2. The second requirement is imposed by the CSS specification you are 
using: "[the style sheet] must contain only at-rules, property names, and 
property values defined in this specification". This is where the "Rules 
for Handling Parsing Errors" 
(http://www.w3.org/TR/1998/REC-CSS2-19980512/syndata.html) also come into 
play. This section describes three types of parsing errors: unknown 
properties, illegal values , and invalid at-keywords. However, these don't 
seem to cause ambiguity: the user agent is required to ignore declarations 
with these errors.

3. There may be other conformance requirements, but in the case of CSS 2, 
these are requirements for user agents, not stylesheets 
(http://www.w3.org/TR/1998/REC-CSS2-19980512/conform.html#conformance).


Because of the error handling rules at the second level, it seems to me 
that only correct grammar is necessary for a CSS stylesheet to pass SC 
4.1.1. However, anything that does not pass at the second level (according 
to the most recent CSS specification in your baseline) is outside the 
baseline. Does this make sense?

Best regards,

Christophe Strobbe


-- 
Christophe Strobbe
K.U.Leuven - Departement of Electrical Engineering - Research Group on 
Document Architectures
Kasteelpark Arenberg 10 - 3001 Leuven-Heverlee - BELGIUM
tel: +32 16 32 85 51
http://www.docarch.be/ 


Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm

Received on Monday, 12 June 2006 10:41:28 UTC