- From: Alan Gresley <alan@css-class.com>
- Date: Tue, 05 Apr 2011 03:15:17 +1000
- To: CSS 3 W3C Group <www-style@w3.org>
Hello all, I'm trying to find in the spec what is meant to happen when a property-value pairing or value alone does not appear in a string with parentheses '(....)'. @media () { body p { background: red } } CSS2.1 has this 7.2.1. <http://www.w3.org/TR/CSS21/media.html#at-media-rule> Nothing is mentioned about what should happen if no properties values are declared. The spec does not even mention properties or values. The link to the word 'statement' in 7.2.1 is incorrect. It currently points here, http://www.w3.org/TR/CSS21/syndata.html#tokenization instead of here, http://www.w3.org/TR/CSS21/syndata.html#statements but this is incorrect anyway because properties and values are one type of statement. Perhaps it should point here instead. http://www.w3.org/TR/CSS21/syndata.html#at-rules This part of the spec also does not mention properties or values but are bundled up as being part of 'everything' in the below spec. # An at-rule consists of *everything* up to and including the # next semicolon (;) or the next block, whichever comes first. CSS3 has this (point 3). http://dev.w3.org/csswg/css3-mediaqueries/#media1 # Properties always require a value to form a declaration. In this test case. http://css-class.com/test/css21testsuite/at-rule-020.xht In Firefox 3.6.16, the line is red. p { background: red; color: white } @media () { body p { background: orange } } p { background: green } If the parentheses had '(foo)' thought, Firefox 3.6.16 drops it. FF 4b does not have the bug. In this test case. http://css-class.com/test/css21testsuite/at-rule-021.xht In IE9 and WebKit, the line is red. @media ( { body p { background: orange } } p { background: red } According the nesting of blocks, remainder of the style-sheet should be thrown out due to a malformed statement resulting in an unexpected end of style sheet. I should mention that IE8 shows a green line. A string within parentheses in a media query must have either have a property and value pairing or value to form a declaration. If no such value exist, the media query should be ignored. In a reply to me [3] in a different thread 'Re: [CSS2.1] blocks with missing end bracket and parsing error', Bjoern writes: > Some time ago the CSS Working Group decided to change slash > clarify the specification to require {[()]} matching when > parsing selectors. Doing some digging I find this is based on issue-106 [1] and these CSS WG minutes [2]. Currently browsers are parsing garbage syntax and this results in many possible hacks for very recent versions of browsers. [1] http://wiki.csswg.org/spec/css2.1#issue-106 [2] http://lists.w3.org/Archives/Public/www-style/2008Jul/0589.html [3] http://lists.w3.org/Archives/Public/www-style/2011Mar/0579.html -- Alan http://css-class.com/ Armies Cannot Stop An Idea Whose Time Has Come. - Victor Hugo
Received on Monday, 4 April 2011 17:15:55 UTC