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

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

From: Rune Lillesveen <rune@opera.com>
Date: Fri, 14 Jun 2013 21:14:49 +0200
Message-ID: <51BB6BA9.6090106@opera.com>
To: www-style@w3.org
On 06/14/2013 07:41 PM, Simon Sapin wrote:
> 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.

I think a motivation for doing auto-closing at all is to cover author 
intent. I don't find it likely that a missing block indicates the 
intention of an empty block. The only case it matters is when the author 
wants to populate the empty rule through CSSOM, or if the rule is parsed 
through CSSOM to replace another rule.

I agree that Syntax 3 makes sense.

Rune Lillesveen
Received on Friday, 14 June 2013 19:15:19 UTC

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