[csswg-drafts] [css-syntax-3] <hash-token> seems to get type ID for sequence "#-\" followed by EOF

bathos has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-syntax-3] <hash-token> seems to get type ID for sequence "#-\" followed by EOF  ==
In [consume a token](https://drafts.csswg.org/css-syntax-3/#consume-token), the following steps are given for handling "#":

> If the next input code point is a name code point or the next two input code points are a valid escape, then:
> 1. Create a `<hash-token>`.
> 2. If the next 3 input code points would start an identifier, set the `<hash-token>`’s type flag to "id".
> 3. Consume a name, and set the `<hash-token>`’s value to the returned string.
> 4. Return the `<hash-token>`.

The "would start an identifier" check confirms that the backslash of an escape is not followed by a newline, but confirming that it is not followed by EOF is deferred to "consume an escaped codepoint", via "consume a name" (step 3).

I’m not sure if it really matters in practice (perhaps this is even intentional), but it struck me as odd that (assuming I’m reading it correctly) this would mean that the sequence `U+0023 U+002D U+005C EOF` would produce a hash token whose type is set to ID, even though "-" isn’t a valid ID.

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/1821 using your GitHub account

Received on Sunday, 17 September 2017 03:10:13 UTC