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

RE: [css-syntax] value grammar, <value> type and browser implementations

From: François REMY <francois.remy.dev@outlook.com>
Date: Wed, 6 Feb 2013 11:25:32 +0100
Message-ID: <DUB002-W125F1700F250C6A38830F1FA5070@phx.gbl>
To: "L. David Baron" <dbaron@dbaron.org>
CC: Simon Sapin <simon.sapin@kozea.fr>, Tab Atkins Jr. <jackalmage@gmail.com>, www-style list <www-style@w3.org>
> It looks to me like the only things forbidden inside of a block
> inside of a value by
> http://www.w3.org/TR/CSS21/syndata.html#tokenization are:
> 1. unmatched }, ], and )
> 2. {, [, and ( without a matching pair later
> 3. BAD_STRING, BAD_URI, and BAD_COMMENT
>
> Is the intent of your comment to suggest that (2) and (3), that is,
> opening constructs that don't have a matching closing construct,
> should be allowed within value?
> 
> Or are there other differences that I'm missing?

I was actually working with a wrong grammar in mind (confused block and ruleset, for some reason), resulting in mistakes in some of my examples. {a} and {;;} are indeed valid values.


However, my initial problem is that Webkit and Trident actually reject valid custom properties declarations for some reason (I guess they parse the values according to CSS 2.1 but actually validate them against the informative grammar found in Appendix G [1]). This is my initial and most important concern, and we should probably to get that right. If FireFox only checks that the open-close tokens have a match, it seems fine to me.


My take is: we should accept any value as long as it doesn't contain any ';' and '}' at top-level, because those tokens are used to close the value production. I'm not against allowing unmatched closing tokens (your (1)) for instance. I believe Tab has the same general point of view, so I'm fine letting Tab resolve the problem the way he intended. 


I just have one other question, and this time about serialization. It's fine if browser do accept any value, but is there any spec that says how the 'element.style.myCustomProperty' will be serialized if it contains a particular input? Is it kept as-is or is it reserialized the same way JSCSSP is doing?

For info, JSCSSP is returning '{ a : a }' from a '{a:a}' input (so it separates each token by a whitespace even if it is not necessary, and doesn't preserve white spaces). I must say I've a preference for 'serialized as in input' but I can understand browser prefer to keep tokens only and reserialize back the entry each time it's requested.


[1] http://www.w3.org/TR/CSS2/grammar.html 		 	   		  
Received on Wednesday, 6 February 2013 10:26:01 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:21:05 GMT