-
Notifications
You must be signed in to change notification settings - Fork 715
[css-color] Be more explicit that color names are *ASCII* case-insensitive #4599
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
Comments
Agreed, I'll fix to link to the definition of ASCII case-insensitive. And yes, any other instances of "case insensitive" that don't link to the Infra definition are a bug and should be fixed, please feel free to point them out. |
For the CSS named colors from X11, those are all ASCII-only in any case so the distinction (while useful to clarify) has no observable effect unless more are added later which use full Unicode. The |
@svgeesus Having ASCII-only names is not enough because ftp://ftp.unicode.org/Public/UNIDATA/CaseFolding.txt has mappings from non-ASCII to ASCII characters. As I pointed out in the description, FYI I recently fixed a similar bug in Chromium where e.g. |
In two notes of the css-values spec previously mentioned, "case-insensitive" is used where ASCII case insensitive is meant (https://www.w3.org/TR/css-values-4/#frequency and https://www.w3.org/TR/css-values-4/#absolute-lengths). Difference could be observable with "KHz" (using U+212A Kelvin Sign). |
Other notable cases are
|
Surely this is the same situation that exists for font family names, in which case the "default caseless" matching referenced there is appropriate in this case as well? https://www.w3.org/TR/2018/REC-css-fonts-3-20180920/#font-family-casing. This would match "SILVER", "Silver", "ſilver" and "silver". |
Correct. The difference is that for the css-color and css-values specs, these are pre-defined ASCII strings for which the matching "LATIN CAPITAL LETTER SHARP S" or "KELVIN SIGN" with "S" and "K" does not seem intentional. But the font-family names are user-specified, it seems reasonable to apply case equivalences for non-ASCII (e.g. accented characters), and the case folding method is clearly explained in the paragraph you mentioned. Going over other CSS specs quickly, the other instances I found are:
|
Yeah, CSS (and most of the web) is very intentionally either (a) ASCII case-insensitive (mapping only a-z and A-Z together) or (b) fully case sensitive (two strings are equal iff they're codepoint-equal). Nothing between those two should ever be introduced without a very good reason. Fonts, I believe, have legacy constraints causing them to use the in-between algo of "default caseless", but I'm going to file a bug to make sure that's actually necessary. |
Fixed by 51b9c15 |
Also fixed in 1b157d5 for CSS Color 3 |
From the CSS color spec:
However, the CSS value spec says pre-defined keywords are ASCII case-insensitive:
https://drafts.csswg.org/css-values-4/#keywords
Concretely, ftp://ftp.unicode.org/Public/UNIDATA/CaseFolding.txt has this line:
which means that
ſilver
is case-insensitively equal tosilver
. However, it is not ASCII case-insensitively equal tosilver
(only a-z <-> A-Z equivalence are considered in that case).Blink, Webkit and Gecko seems to treat colors as ASCII case-insensitive.
Note: I'm opening this for the color spec, but it is probably worth checking that for other CSS specs too.
The text was updated successfully, but these errors were encountered: