Skip to content

[css-syntax-3][css-values-4] definition of <ident> seems to require U+xxxx form #6766

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
svgeesus opened this issue Oct 26, 2021 · 2 comments
Labels
Closed as Question Answered Used when the issue is more of a question than a problem, and it's been answered. Commenter Satisfied Commenter has indicated satisfaction with the resolution / edits. css-syntax-3 css-values-4 Current Work

Comments

@svgeesus
Copy link
Contributor

CSS defines a large set of named colors, so that common colors can be written and read more easily. A <named-color> is written as an <ident>,
https://drafts.csswg.org/css-color-4/#named-colors

which links to

CSS identifiers, generically denoted by <ident>, consist of a sequence of characters conforming to the <ident-token> grammar.
https://drafts.csswg.org/css-values-4/#typedef-ident

which links to

<ident-token>, <function-token>, <at-keyword-token>, <hash-token>, <string-token>, and <url-token> have a value composed of zero or more code points.
https://drafts.csswg.org/css-syntax-3/#typedef-ident-token

and code points links to

A code point is a Unicode code point and is represented as "U+" followed by four-to-six ASCII upper hex digits, in the range U+0000 to U+10FFFF, inclusive. A code point’s value is its underlying number.

A code point may be followed by its name, by its rendered form between parentheses when it is not U+0028 or U+0029, or by both.
https://infra.spec.whatwg.org/#code-point

Uh ok so U+0020 is a code point, as is U+0020 SPACE but a is not a code point and thus, the CSS named colors like green (to take an example use of CSS <ident>) don't follow the grammar because they are not written as a bunch of U+things

It seems that the wrong definition in Infra is being linked to?

Or am I misunderstanding "represented as"?

@svgeesus
Copy link
Contributor Author

(My original point in following this chain was to answer the question "can <ident> contain a space" and it seems it can contain anything including C0 and C1 control characters, noncharacter, etc which is surprising)

@tabatkins
Copy link
Member

Or am I misunderstanding "represented as"?

You're misunderstanding - that's just talking about how we represent code points in specs when talking about them. The same sort of wording is used consistently across the Infra definitions, as Infra is defining the common language we should be using in spec writing for various concepts.

(I agree that jumping from the CSS spec to the Infra spec is a little bit of a conceptual twist as it's currently worded. Maybe it could use slightly more obvious wording?)

(My original point in following this chain was to answer the question "can contain a space" and it seems it can contain anything including C0 and C1 control characters, noncharacter, etc which is surprising)

That would be surprising, since it's incorrect. ^_^ Are you basing that just on the "have a value composed of zero or more code points" phrase?

If you look slightly further down, in the railroad diagrams, the <ident-token> grammar's diagram makes it clear what code points are allowed. The normative answer for what's allowed in an ident, tho, is "whatever characters pass the 'starts an identifier' check and then subsequently are part of the return value of 'consume an identifier'".

@tabatkins tabatkins added the Closed as Question Answered Used when the issue is more of a question than a problem, and it's been answered. label Oct 26, 2021
@svgeesus svgeesus added the Commenter Satisfied Commenter has indicated satisfaction with the resolution / edits. label Oct 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Closed as Question Answered Used when the issue is more of a question than a problem, and it's been answered. Commenter Satisfied Commenter has indicated satisfaction with the resolution / edits. css-syntax-3 css-values-4 Current Work
Projects
None yet
Development

No branches or pull requests

2 participants