W3C home > Mailing lists > Public > public-css-archive@w3.org > December 2020

Re: [csswg-drafts] [css-syntax-3] Is two hyphens a valid identifier? (#5764)

From: Oriol Brufau via GitHub <sysbot+gh@w3.org>
Date: Sun, 06 Dec 2020 20:49:52 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-739561658-1607287791-sysbot+gh@w3.org>
https://drafts.csswg.org/css-syntax/#would-start-an-identifier says

> Look at the first code point:
>   If the second code point is [...] a U+002D HYPHEN-MINUS, [...] return true.

So `--` starts an identifier.

Then, in https://drafts.csswg.org/css-syntax/#consume-token

> - U+002D HYPHEN-MINUS (-)
>   [...] if the input stream starts with an identifier, reconsume the current input code point, consume an ident-like token, and return it.

So I would say yes. And a single underscore `_` is also an identifier (and this was the case even in [CSS2](https://www.w3.org/TR/CSS21/syndata.html#value-def-identifier)). The non-normative description seems wrong.

GitHub Notification of comment by Loirooriol
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/5764#issuecomment-739561658 using your GitHub account

Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Sunday, 6 December 2020 20:49:55 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 5 July 2022 06:42:23 UTC