[CSS21][css-syntax] EOF in string and URL tokens

Hi,

The way tokenization is defined in CSS 2.1, the end of the stylesheet in 
the middle of a quoted string or url() notation produce a BAD_STRING and 
BAD_URI token, respectively. The "bad" in the name implies that such 
tokens are syntax errors, and should for example make a Custom Property 
declaration invalid/ignored.

http://www.w3.org/TR/CSS21/syndata.html#tokenization


However, the "Unexpected end of style sheet" error handling rule later 
in the same chapter seems to contradict this. End of stylesheet in a 
quoted string is said to produce a valid string. Same for url() assuming 
it is considered a "construct". ("Construct" is not defined precisely.)

http://www.w3.org/TR/CSS21/syndata.html#unexpected-eof


The only way I see to interpret this is that a BAD_STRING or BAD_URI 
token is considered valid if (and only if?) it is followed but the end 
of the stylesheet. This seems to be a bug in 2.1. If we want such cases 
to be valid, the tokenizer should emit "good" STRING or URI tokens, 
which is what Syntax 3 does.

This seems to be the be the behavior intended by the EOF rule, but is 
it? Should we fix 2.1?

-- 
Simon Sapin

Received on Monday, 27 May 2013 11:35:14 UTC