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

Le Ven 14 juin 2013 13:41, Simon Sapin a écrit :
> 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>

Simon,

I think foo.css should apply.

There is a test on such precise code:
[RC6]
http://test.csswg.org/suites/css2.1/20110323/html4/eof-006.htm
[nightly-unstable]
http://test.csswg.org/suites/css2.1/nightly-unstable/html4/eof-006.htm

Also,
[RC6]
http://test.csswg.org/suites/css2.1/20110323/html4/eof-005.htm
[nightly-unstable]
http://test.csswg.org/suites/css2.1/nightly-unstable/html4/eof-005.htm
is when there is no closing double-quote '"', such as
@import "foo.css /* No closing double-quote and No semicolon */<EOF>


> 2. @media print/* No block */<EOF>

There is no opening curly brace "{" here. So I think this should be ignored.


Test when/where there is an opening curly brace and the start of a rule:
[RC6]
http://test.csswg.org/suites/css2.1/20110323/html4/eof-004.htm
[nightly-unstable]
http://test.csswg.org/suites/css2.1/nightly-unstable/html4/eof-004.htm

> 3. h1, h2/* No block */<EOF>

No opening curly brace "{" either here. There is no declaration block
which could or would have to be applied anyway. I don't see how this sort
of code can be tested.

Gérard


> 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
>
>


-- 
CSS 2.1 Test suite RC6, March 23rd 2011
http://test.csswg.org/suites/css2.1/20110323/html4/toc.html

Contributions to CSS 2.1 test suite
http://www.gtalbot.org/BrowserBugsSection/css21testsuite/

Web authors' contributions to CSS 2.1 test suite
http://www.gtalbot.org/BrowserBugsSection/css21testsuite/web-authors-contributions-css21-testsuite.html

Received on Friday, 14 June 2013 20:01:57 UTC