- From: Greg Houston <gregory.houston@gmail.com>
- Date: Mon, 27 Aug 2012 17:30:40 -0500
- To: Christoph Päper <christoph.paeper@crissov.de>
- Cc: www-style list <www-style@w3.org>
On Mon, Aug 27, 2012 at 5:08 PM, Christoph Päper <christoph.paeper@crissov.de> wrote: > Jens O. Meiert (2012-08-22): > >> are there any plans to extend CSS’s comment syntax? > > Did you have anything else in mind? Incorporating something like “CSSdoc”? > > With comments you have to consider two major use cases: documentation and debugging. > >> Like, allowing one-line comments via e.g. “//”? > > I assume it was a deliberate design decision to only support start-end comments in CSS1. It was not a bad one either. Code lines are irrelevant for everything else in CSS (except ‘@charset’ maybe) and it is sometimes complicated, already, to define where a comment should be valid to start and end. > > It would be possible, though, to define a special character, (possibly very short) keyword or prefix for at-rules, selectors, simple selectors, properties or values (or all of them) that was guaranteed to make the select part invalid. You could rely on existing syntax restrictions for that, of course, but maybe it would make sense to explicitly introduce such structural disablers. That wouldn’t be used for documentation, though. Other than HTML and CSS, just about every other language I can think of including JavaScript allows for single line commenting using either // or # depending on the language. I'm not sure why CSS would prove to be a special case. Single line comments are a great convenience when developing for temporarily removing declarations, and nice for comments after declarations. Less CSS allows for single line comments and I use them all the time. http://lesscss.org/ Note that single line comments are not generally used for entire "select parts" as you put it above, unless the entire rule is written on one line. Generally one line commenting is used for removing single declarations or as a comment after a single declaration. It's the same in JavaScript, you would try to single line comment out an entire function, but rather single line comment out individual commands within that function.
Received on Monday, 27 August 2012 22:31:09 UTC