[CSS21][css-syntax] Does selector+EOF create an empty rule?

Hi,

The "Unexpected end of style sheet" rule of CSS 2.1 says " User agents 
must close all open constructs (for example: blocks, parentheses, 
brackets, rules, strings, and comments) at the end of the style sheet."

Does this apply to rules that are (in Syntax 3 terms) in their 
"prelude"? For example:

1. @import "foo.css"/* No semicolon */<EOF>
2. @media print/* No block */<EOF>
3. h1, h2/* No block */<EOF>

Only 1. has an effect on the cascade, but all three examples are 
testable in CSS OM.

In the Syntax 3 ED as current written, EOF in the middle of an at-rule’s 
prelude, it implies a semicolon:

1. is assumed to be @import "foo.css"; and is valid
2. is assumed to be @media print; which is not a valid @media rule

In a qualified rule prelude (as in 3.) EOF is an error and the rule is 
dropped. In other words, EOF in the middle of a selector does *not* 
create a style rule in the OM.

Mozilla issue: https://bugzilla.mozilla.org/show_bug.cgi?id=446226


I think that this Syntax 3 behavior makes the most sense, and would like 
to check WG consensus.

Cheers,
-- 
Simon Sapin

Received on Friday, 14 June 2013 17:42:18 UTC