Re: Comment syntax

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.

Received on Monday, 27 August 2012 22:08:57 UTC