-
Notifications
You must be signed in to change notification settings - Fork 757
Description
I have been attempting to write a CSS tokenizer following the steps listed here:
https://drafts.csswg.org/css-syntax-3/#consume-token
However, it seems that there's no way (that I can see) to tokenize a hex color according to the steps listed.
When reaching U+0023 NUMBER SIGN (#), it contains instructions to create a hash token, but the instructions do not include a way to tokenize a hex color into a series of tokens that could be reasonably interpreted as a color.
example 1: #1e2125 <delim-token #><number-token 1*10^2125> (which ends up being "rounded to Infinity")
example 2: #ee2125 <hash-token #ee2125>
example 3: #1a2125 <delim-token #><number-token 1><ident-token a2125>
I could not find anything in document that covers this.
link to my test case: https://github.com/tbjgolden/media-query-parser/blob/main/src/parse/lexicalAnalysis.test.ts#L183-L245