- From: Tab Atkins Jr. <jackalmage@gmail.com>
- Date: Tue, 11 Dec 2018 16:07:22 -0800
- To: Yves Lafon <ylafon@w3.org>
- Cc: www-style list <www-style@w3.org>
On Mon, Dec 10, 2018 at 5:25 AM Yves Lafon <ylafon@w3.org> wrote: > I noticed that the legacy rgb() syntax is defined in https://drafts.csswg.org/css-color/#rgb-functions (20180926 edition) as > "rgb( <percentage>#{3} , <alpha-value>?) ) | rgb( <number>#{3} , <alpha-value>? )” > It should probably be "rgb( <percentage>#{3} [ , <alpha-value> ]?) ) | rgb( <number>#{3} [ , <alpha-value> ]? )” to avoid rgb(11,22,33,) being valid. Nope, it's correct as written, see <https://drafts.csswg.org/css-values/#comb-comma>. Commas written in the *grammar* don't necessarily correspond to commas accepted in the *input*; only commas that actually separate comma-separated options are valid. This makes some common grammar patterns easier to read and write, and avoids otherwise-necessary repetition of terms. (In particular, patterns like `A? , B?` are much harder to write if commas are taken literally; you have to repeat at least one of the terms and it's not immediately obvious what is meant by reading the result, whereas `A? , B?` is simple and clear unless you're reading too literally and don't know about the comma omission rules. ^_^) ~TJ
Received on Wednesday, 12 December 2018 00:07:57 UTC